"This application is not allowed to use Firebase Authentication" in the emulator

I get this error when I try to run the application on an emulator.

What I've done:

  • I am using Firebase-UI and running Android O
  • I have updated the Play Store.
  • I added all the SHA-1 code to the Firebase console and the package name match.

In fact, when I run the application on a real device, it works fine and I can log in.

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) 
+21
source share
8 answers

In order to prevent abuse, phone authentication in Firebase will not work in the emulator.

But if you want to use it for testing, you should add a phone number for testing in the Firebase console, which will work in the emulator.

Go to the Firebase console β†’ Authentication β†’ Login method β†’ ​​Phone and check the box β€œPhone numbers for testing (optional)”.

enter image description here

+37
source

OK, so this is a documented error. https://github.com/firebase/FirebaseUI-Android/issues/790 and https://github.com/firebase/FirebaseUI-Android/issues/868

to prevent abuse, you cannot use Phone Auth on the emulator.

Docs are here: https://firebase.google.com/docs/auth/android/phone-auth#before-you-begin

Also note that a physical device is required to enter the phone number and it will not work on the emulator.

UPDATE Look at Prasanne Anbu's answer.

+9
source

You need to configure SHA-1 in the firebase console.

You can do this very easily with the help of Android Studio tools.

  • Open Tools -> Firebase in Android Studio.
  • Press any of the functions, for example Authentication or RealtimeDatabase .
  • Click Connect to Firebase and complete the necessary steps.

or

Add it manually. Check this..

How to add SHA-1 to Android app

+5
source

sha1 generation in android studio:

Select Gradle in Android Studio from the right pane.

Choose your application

In tasks -> android-> signatureReport

Double click on the report signature.

You will find the sha1 fingerprint in the Gradle Console

add this sha1 fingerprint to the Firebase console

+5
source

Your SHA1 key is not registered with your Firebase console. Just generate the SHA key, as shown in the figure below, copy the SHA key from the Android Studio terminal and add it in the project settings of the Firebase console:

enter image description here

Also make sure that you use the release key store to generate this key.

enter image description here

enter image description here

After that, create your SHA1 fingerprint, otherwise your users will encounter a SHA1 error when authenticating the phone.

Hope this helps someone.

+3
source

Generate SHA-1 certificate prefer this link fingerprint SHA-1 key store certificate
enter image description here

after opening firebase console and add this SHA-1 here.

0
source

I also ran into a similar problem in the native response assembly, as shown in the image below. I solved the problem by following these steps.

enter image description here

According to @adirzoari, open your own project in Android studio, and then:

  1. Run your project.
  2. Click on the Gradle menu.
  3. Expand the Gradle task tree.
  4. Double click on Android -> signatureReport and you will see the result

For Android studio 2.2 - the result will be available in the "Run the console" section, but use the dedicated switch button.

0
source

After spending all day figuring out what the problem is. I found the culprit! We signed up for the Signing for Google Play app. We need to register SHA-1 in the application signature itself. You can find it in the Google Play console under Release Management> Application Signature. It will have two types of certificates: 1. Download certificate : this is the certificate information from the downloaded keystore. This should match the keystore for local signing of the application, as Google Play will check the downloaded application for compliance with the signed certificate.

2. Application signing certificate : after downloading the application, Google will replace the download certificate with this certificate. This is the new certificate that will be used for the published application on the Play Store.

With this information, I simply understand that we did not register SHA-1 for the application signing certificate used by the published application. So, I added the SHA-1 fingerprints (also SHA-256, just in case) in Firebase> Project settings for the application (do not forget to update the last configuration file after adding the fingerprints).

So after adding your SHA fingerprints, your Firebase SHA certificate fingerprints will look like this:

enter image description here

Now save the changes, then go back to your application and test it again, now it will work!

0
source

Source: https://habr.com/ru/post/1270910/


All Articles