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.

Community
  • 1
  • 1
bibi_bryan
  • 371
  • 3
  • 17

1 Answers1

1

You can generate a UUID (http://en.wikipedia.org/wiki/Universally_unique_identifier) on your server and store it in a database. if you're worried about conflicts, check if the generated UUID already exists and if so, generate another one.

In order to send a SMS from Your server, You'll need to use some sort of SMS gateway (such as Twilio)

Gal Ben-Haim
  • 17,433
  • 22
  • 78
  • 131