Search code examples
javaandroidfirebasefirebase-authenticationone-time-password

Getting wrong app name in auth OTP from firebase


Like my app name is Hotel Management And the OTP is " 543255 is your verification code for hotel-management.firebaseapp.com. "

And the app is in debug mode , so according to the firebase documentation one should only get the otp Like " 543255 is your verification code."

Now the problem is that the onVerificationCompleted method is not executing when the user receives code, and thus needs to enter OTP manually. I searched and delved a lot and got that the template of SMS plays a important role and in my case it's wrong. How to get correct app name?

Thanks in advance for any kind of help😅

Note: I'm using the latest version of firebase auth.


Solution

  • It's not the wrong app name, it's your firebase PROJECT_URL. To confirm go to firebase console, then project setting check your project id and your project URL is : Project ID.firebaseapp.com

    I faced the same issue so after doing some research I found out these reasons :

    1. If Your device doesn't have play services installed.
    2. If your device bootloader is unlocked or your device is fully rooted.
    3. It can be related to using the reCAPTCHA verifier flow. This flow is used by Firebase to prevent abuse, such as by ensuring that the phone number verification request comes from one of your app's allowed domains.
    4. The %PROJECT_URL% is only used if a reCAPTCHA is shown. In order to avoid the issue implement SafetyNet, avoiding the reCaptcha.

    To implement safetyNet check these links :

    https://stackoverflow.com/a/65230860/9942608

    https://stackoverflow.com/a/66039511/9942608