Firebaseui-android: Phone verification not working on emulator: invalid_app_credential

Created on 5 Jul 2017  路  15Comments  路  Source: firebase/FirebaseUI-Android

Hello

  • Android device: API 26
  • Android OS version: 7.1
  • Google Play Services version: 3.1.0
  • Firebase/Play Services SDK version: 11.0.1
  • FirebaseUI version: 2.0.1

Step 3: Describe the problem:

I'm getting issue when I try to use firebase UI authentication phone verification on an emulator. I get an error says

Internal error has occurred [invalid_app_credential: app validation failed]

Observed Results:

Error description received from server: INVALID_APP_CREDENTIAL : App validation failed
BasicNetwork.performRequest: Unexpected response code 400 for https://www.googleapis.com/identitytoolkit/v3/relyingparty/sendVerificationCode?alt=proto&key=AIzaSyDWGycBk58rjdR5IlyaUMhT4XXkzhKaxQE

Most helpful comment

I tried to add my testing phone number in firebase console but it didn't worked also

All 15 comments

same issue in moto g 1st gen
edited

My issue was in the emulator but when I install the app on my Samsung Galaxy. It works perfectly.

Hi all this is by design. Phone Authentication uses a lot of signals to prevent fraud which means it can't work on an emulator. You'll need to test on a real device.

I though It was done to prevent abuse.
Any how. At least the error message should indicate this. @samtstern

What i do for this error on my android device?

@kishansinhparmar does the email and password works perfectly ?. if it is not you may have issue with firebase configuration see the documentation. Otherwise, firebase auth may think your device is an emulator or rooted. Like @samtstern what said. It seems Google is trying to prevent any case of abusing Firebase phone verification.

yup rooted...but what about sign in with google?
While sign in with google
E/GoogleProvider: Error logging in with Google. 10 null

@kishansinhparmar try to re-sync firebase or redo the firebase configuration. I've no idea

@MuBoori thanks...try to re-sync

Is this problem also occurs on rooted devices?

  1. Phone Auth doesn't work on emulators.
  2. Phone Auth does work on rooted device, but features like instant validation won't work.
  3. Google Sign-In works on emulators
  4. There are many reasons to invalid_app_credential, e.g.
    a) Missing right package name + SHA1 registration
    b) Phone Auth not turned on in console
    c) emulators
    ...
    If your Google Sign-In also doesn't work, at least you should check 3a)

Phone auth works in emulator but only with testing phone numbers.
Please read the stackoverflow answer here

Anyone know how it detects if the device being used is a physical device?

I tried to add my testing phone number in firebase console but it didn't worked also

Your problem related to SHA1 and SHA256 keys. You have to add them to authenticate your certs.

Goto

Firebase Console of your project
Authentication
Project Setting (From Setting button near Project Overview)
Add fingerprint
Add SHA-1 and SHA-256 values of your keystore.
You can get keystores from gradle like this.

./gradlew signingReport

Read this for more information: https://firebase.google.com/docs/auth/android/phone-auth#enable-app-verification

Was this page helpful?
0 / 5 - 0 ratings