1

I have been trying to implement a sort of One-Time phone number verification system in my android app.

I researched and discovered that outfits like twilio were offering this service, but they are all expensive to use. All i want is just a Random, Unique code that would be sent to the phone number the user supplied.

So searched some more and found this post on stackoverflow, which talks about generating unique, random alphanumeric Strings using openssl_random_pseudo_bytes($bits). But i don't know the way forward from here.

My Problems

  1. After generating the Strings and saving them in the database. How do i send one to the user's phone number.(I imagine i would need some sort of SMS API).

  2. How secure is this method of generating the random strings.

Thank you.

4

1 回答 1

1

您可以在您的服务器上生成一个 UUID ( http://en.wikipedia.org/wiki/Universally_unique_identifier ) 并将其存储在数据库中。如果您担心冲突,请检查生成的 UUID 是否已经存在,如果存在,请生成另一个。

为了从您的服务器发送 SMS,您需要使用某种 SMS 网关(例如 Twilio)

于 2013-11-11T08:21:10.973 回答