I'm getting this error when I try to run my app on emulator.
What I've done:
In fact when I run the app on a real device it runs perfectly and I can login.
This app is not authorized to use Firebase Authentication. Please verify that the correct package name and SHA-1 are configured in the Firebase Console.
com.google.firebase.auth.FirebaseAuthException: This app is not authorized to use Firebase Authentication. Please verifythat the correct package name and SHA-1 are configured in the Firebase Console. [ App validation failed. Is app running on a physical device? ]
at com.google.android.gms.internal.jz.zzK(Unknown Source:239)
at com.google.android.gms.internal.kp.zza(Unknown Source:2)
at com.google.android.gms.internal.kq.run(Unknown Source:37)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
To authenticate a service account and authorize it to access Firebase services, you must generate a private key file in JSON format. To generate a private key file for your service account: In the Firebase console, open Settings > Service Accounts. Click Generate New Private Key, then confirm by clicking Generate Key.
In the Firebase console, open the Authentication section. In the Sign in method tab, enable the Phone provider if you haven't already. Open the Phone numbers for testing accordion menu. Provide the phone number you want to test, for example: +1 650-555-3434.
In order to prevent abuse the firebase phone authentication wont work in emulator.
But if you want it for testing purpose then you should add use some testing phone number in firebase console that will work in emulator.
Go to your firebase console -> Authentication -> SIGN-IN Method -> Phone and check the "Phone numbers for testing (optional)" field.
sha1 generation in android studio:
Select Gradle in android studio from right panel
Select Your App
In tasks -> android-> signingReport
Double click signingReport.
You will find the sha1 fingerprint in the "Gradle Console"
add this sha1 fingerprint in firebase console
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With