Firebase Phone Auth Exception: SMS Code has expired in Android Only - android

I am getting an issue of Firebase Phone Auth Verification at the time of registration. It was working perfectly at all before a week but just from a week getting this exception even OTP has not expired nor session time out.
Wondering thing is that at the time of registration when I enter a phone number which is not in the entry of "Firebase Authentication User" list, OTP received on a phone number automatically detects OTP from the method of firebase itself / also tried with entering manually OTP code within 1 minute and then call to
auth.signInWithCredential(credential)
makes entry to "Firebase Authentication User" list, it means to verified successfully but at the client side, it throws an exception of "The SMS code has expired. Please re-send the verification code to try again"
This issue also came in the project's web version 1 week ago but after a day it was automatically resolved without any changes.
I checked for iOS version too but it works perfectly but just in Android only when tries to verify the OTP by auto-detection or manually, it gives this error only.
Any help would be appreciated.

Related

FirebaseAuth SMS verification code request failed

I don't know what does this error mean. I've search a lot on Google, but couldn't find why am I getting this error.
E/FirebaseAuth( 5673): [SmsRetrieverHelper] SMS verification code request failed: unknown status code: 17052 Exceeded quota.
I'm trying to authenticate android client with firebase phone auth sign-in method, and trying to verify their phone number by sending a verification code on their phone. No code is being sent and no callback function is called. I don't know what is the problem here
and i enable the Phone Sign-in method in your firebase
Android Device Verification is enable
Firebase limits daily SMS allowed to prevent abuse. You can refer to this other thread Firebase Authentication SMS Quota exceeded for this project

Firebase Phone Authentication - OTP received but invalid

I have implemented firebase phone authentication for my mobile application based on react-native and built for android mobiles. The firebase authentication process occurs in the backend (PHP/Laravel) and works properly most of the time. However in some cases, the user registers, receives and OTP, however when inputting the OTP I get an Invalid OTP error (mismatch between the one generated in firebase and the one entered).
The process is as follows:
User registers
OTP is sent
OTP is received
OTP entered automatically on the mobile (I have tried manual input as well)
On success, the user is added to firebase (visible from the user table), and then added to the application user list in our backend
On failure (wrong OTP), the user will not be added to the firebase table and a failure response is sent to our backend and display on the mobile as "OTP Invalid"
In random occasions, we are getting an invalid OTP response even though the input is the correct one received. This is happening with new numbers registering. The same mobile network and provider is being used.
Need to check onVerificationCompleted as on android instant verification can happen which will use another method than success

Firebase phone number verification not always sending sms

I have a use case where I need each user to be identified by a phone number, this is because my shops will need to call the users who request an order , I have followed the documentation and all the github repo with the code
Actually the code worked, and sended to me the sms to verify and all worked just fine !
Now, before release, I have just plugged another phone, requested the code to verify and the code never arrived !
I just tried in another phone with another number and also the verification code has never reached that phone either.
But I actually verified a phone number with the actual code and it works, so, why is the code not reaching my users phone ?
My use case needs this feature and if this is on Firebase side I will need to move to another service
Any suggestions ?
For testing you can use the verification code you added with the test phone number on the console.
Firebase Console Dashboard -> Authentication -> SignIn Method -> Phone -> Phone numbers for testing.
Sometimes, firebase don't need to send the otp for confirmation. it can automatically be done.
This method is called in two situations:
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 either case, the user's phone number has been verified successfully, and you can use the PhoneAuthCredential object that's passed to the callback to sign in the user.
https://firebase.google.com/docs/auth/android/phone-auth#onverificationcompletedphoneauthcredential
Check out the docs for Firebase Phone Verification for Android : https://firebase.google.com/docs/auth/android/phone-auth?authuser=1#test-with-whitelisted-phone-numbers

FCM token registration is not returning token every time

We are calling FCM generate token service in the back ground after login from mobile device. But in Android, we are not getting token and in IOS we are not getting token for OS 12.0.*.
In QA/DEV/UAT environments, it is working fine.
We tried to look our issue on stack overflow but did not get any correct link.
It seems to me that token is not getting called for the first time when user download the app for the first time. If he will uninstall the app/ clear the data then token is getting registered.
We are using below code to generate the token for Android.

Firebase Phone auth by call

Suppose I need to verify users by Firebase phone authentication.
But somehow, user is not getting otp sms. So does firebase gives the option to get the OTP by receiving call?
You can use Firebase Authentication to sign in a new user by sending an SMS message to his phone, he would then receive a verification code to his phone number via SMS which would then allow him to sign in if the code is correct. However it's not possible yet to give the user his verification code via a voice call. Maybe they will do it in a future release ? It would be great indeed !

Categories

Resources