Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing with FirebaseAuth Phone Number verification

In my app we only have phone number verification for signing in. This works flawlessly for the users, but are starting to get a bit painfull when it gets to testing the application.

There are multiple problems:

  1. Phone number verification only works on a physical device.
  2. Signing in multiple times causes a big delay in receiving SMS with verification code. Often I end up not receiving a message at all.
  3. Google thinks that this is suspicious activity and will disable the account after too many attempts of logging in.

Is there any way to solve this? Some kind of debug option to test this more easily?

like image 321
Marius Kohmann Avatar asked Feb 14 '18 21:02

Marius Kohmann


3 Answers

See this section of the Firebase Phone Auth docs. Firebase provides a way to add "whitelisted" numbers for testing purposes. From the docs, these phone numbers do not eat up your usage quota, do not require sending an actual text message and can run consecutive tests on the same phone number without getting throttled.

like image 187
HirdayGupta Avatar answered Oct 14 '22 03:10

HirdayGupta


I tried to use my own phone number until I read this:

Make sure you use fictional numbers that do not already exist. Firebase Authentication does not allow you to whitelist existing phone numbers used by real users. One option is to use 555 prefixed numbers as US test phone numbers, for example: +1 650-555-3434

like image 28
jmbmage Avatar answered Oct 14 '22 03:10

jmbmage


Looks like you'll need a new phone and take a break from testing for a bit.
This is straight from Firebase docs:

To prevent abuse, Firebase enforces a limit on the number of SMS messages that can be sent to a single phone number within a period of time. If you exceed this limit, phone number verification requests might be throttled. If you encounter this issue during development, use a different phone number for testing, or try the request again later.

At the bottom of this section

like image 1
valosip Avatar answered Oct 14 '22 02:10

valosip