"This app is not authorized to use Firebase Authentication" in Emulator

Razvan Cristian Lung picture Razvan Cristian Lung · Aug 16, 2017 · Viewed 46.6k times · Source

I'm getting this error when I try to run my app on emulator.

What I've done:

  1. I'm using Firebase-UI and running Android O
  2. I have the Play Store updated.
  3. I've added all the SHA-1 code to Firebase console and the package name matches.

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)

Answer

Prasanna Anbazhagan picture Prasanna Anbazhagan · May 14, 2018

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.

enter image description here