16

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?

Rob
  • 2,243
  • 4
  • 29
  • 40
Gonzalo4488
  • 439
  • 1
  • 5
  • 14

4 Answers4

49

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.)

E. Sun
  • 1,093
  • 9
  • 15
kazimad
  • 917
  • 9
  • 8
  • 2
    Thanks! wasted hours on it – Nomi Nov 17 '18 at 20:15
  • @kazimad, I am having a similar issue. Where can I find "test devices" on the console?? – Shammir Jan 21 '19 at 10:25
  • 1
    @Shammir it is under Firebase console, Auth, Sign-in method, Phone, Phone numbers for testing (optional) . Hope it helps. – user1510006 May 06 '19 at 23:24
  • 1
    Hey @kazimad , I just do that but I can't receive anything - in a Testing mode "Debugging" you know we write a test verify code and it's work well but after I release my app for Stores I can't get any SMS So should I do something maybe I forget? – Oliver D Nov 28 '19 at 02:10
  • I have not put my number in testing devices. but I have put different numbers. still I am not getting sms. Also when I try from an android device a sms does not come. but from a iPhone it comes. – Parth Anjaria Feb 04 '20 at 13:23
7

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.

Niraj Niroula
  • 2,376
  • 1
  • 17
  • 36
  • 2
    I'm developing this app for iOS so theres no instant verification, and I know it's working and sending the SMS because it's working with any other phone number except mine. I waited a day before trying and again thinking that probably I had reach the maximum tries per day, but that didn't work either. The console doesn't give any logs so I'm totally lost here. Maybe Firebase banned my number? I asked on the firebase slack and the forum but no one seems to answer. I'm using FirebaseUI btw. – Gonzalo4488 Oct 03 '17 at 13:23
  • Yeah, sorry the doc was for android but the third scenario is same for ios as well as android. It seems like you must have exceeded the limit. And if this is the issue, the documentation also says that use a different phone number for testing, or try the request again later(but doesn't say how much later). – Niraj Niroula Oct 03 '17 at 14:02
  • It was probably that I had exceeded the limit because now is working, thanks for the help! – Gonzalo4488 Oct 03 '17 at 14:54
  • <#> ExampleApp: Your code is 5664 r64Iw/6mD1D I want my code in this formet is it possible? – Vajani Kishan Dec 07 '20 at 13:47
  • @VajaniKishan Not sure if it's possible but looks like you are trying to achieve OTP autofill here with that hash code. I reckon, from this source https://www.geeksforgeeks.org/firebase-authentication-with-phone-number-otp-in-android/, we don't need this format to achieve that while using Firebase phone auth. Maybe Firebase handles it by default. – Niraj Niroula Apr 24 '21 at 12:24
1

Check if you added your phone number as s test phone number as below and delete it, if it in test numbers: 1- go to firebase console and select your project, then select Authentication enter image description here

2-got to phone provider enter image description here

3- go down to phone numbers which adds as test numbers and delete your phone number from this list: enter image description here

Ali A. Jalil
  • 873
  • 11
  • 25
0

I changed my initial loading activity to logout activity through AndroidManifest file. Here is the final version:

<activity android:name=".OtpActivity"></activity>
    <activity android:name=".LoginActivity" />
    <activity android:name=".MainActivity" />
    <activity android:name=".MainPageActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

MainPageActivity was my Logout Activity.

double-beep
  • 5,031
  • 17
  • 33
  • 41