android – Firebase Phone Auth won't send me the sms with my code-ThrowExceptions

Exception or error:

I migrated my app from using Digits Phone Auth to the new Firebase Phone Auth but while I was testing my app I had troubles signing out my user (Already fixed that) so I just deleted it from the “User list” on the console but now every time I try to sign in with that phone number it won’t send me the sms with my code, it works fine with any other number but this one. Does someone knows how can I fix this?

How to solve:

I had the same issue. It was because of adding my phone number to test phone numbers at the firebase console. Remove it from “test devices” section.)

###

First check the log, if onVerificationCompleted(PhoneAuthCredential cred) is called or not. If called then this might be the cases:

EDIT: I had answered the question assuming android environment. These two cases are relevant to android programming only.

  • Instant verification: in some cases the phone number can be instantly verified without needing to send or enter a verification code.
  • Auto-retrieval: on some devices, Google Play services can automatically detect the incoming verification SMS and perform verification without user action. (This capability might be unavailable with some carriers.).
    In above cases the the verification process is handled automatically without you needing to enter the code.

Else this might be the case:

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.

Refer Authenticate with Firebase on Android using a Phone Number for more information.

Leave a Reply

Your email address will not be published. Required fields are marked *