Home » Android » Android Applications » Identify and add SHA1 / SHA-256 Certificates to Firebase console for Phone Authentication

Identify and add SHA1 / SHA-256 Certificates to Firebase console for Phone Authentication

For phone authentication, we need to add release SHA1 or SHA-256 key to your firebase console, to identify your app package is connected with your firebase console.

When we didn’t had done this, we got the following “SMS verification code request failed” error,

2-21 22:51:32.521 13044 13070 E FirebaseAuth: [SmsRetrieverHelper] SMS verification code request failed: unknown status code: 17028 A safety_net_token was passed, but no matching SHA-256 was registered in the Firebase console. Please make sure that this application’s packageName/SHA256 pair is registered in the Firebase Console.


02-21 22:51:32.526 13044 13044 W PhoneAuthActivity: com.google.firebase.auth.FirebaseAuthException: 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. [ A safety_net_token was passed, but no matching SHA-256 was registered in the Firebase console. Please make sure that this application’s packageName/SHA256 pair is registered in the Firebase Console. ]

When you are using release key, then this SHA1 , SHA-256 key can be generated using android studio, but when you are working in active development for phone authentication, for debug build / apk, this SHA keys can be seen using command,

$ ./gradlew signingReport

This would show you something like below,

Variant: debug
Config: debug
Store: /home/devlab/.android/debug.keystore
Alias: AndroidDebugKey
MD5: XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX
SHA1: XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX
SHA-256: XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX
Valid until: Wednesday, 28 April, 2049

Now, we need to copy either SHA1 or SHA-256 of above and paste it to your Firebase project. This can be done as,

Login to your Firebase account and select your project. Then, from left sidebase, click settings wheel and select “Project Setings” as shown in below image,

In opened “Project Settings” page, in “General” tab, scroll below and you will see “Your Apps” in that inside “SHA Certificate Fingerprints” click on “Add Fingerprint” and copy paste either SHA1 or SHA-256 as seen on “gradlew signingReport” command.


Subscribe our Rurban Life YouTube Channel.. "Rural Life, Urban LifeStyle"

4 thoughts on “Identify and add SHA1 / SHA-256 Certificates to Firebase console for Phone Authentication”

  1. Hello,
    I developed a chat app in android studio, and added SHA1 and SHA256. it works on my mobile to send otp, but when i create APK file, and click to send otp, it shows error,
    `this app is not authorized to use firebace authentication. Please, verify correct package name and SHA1 are configured in firebase console. (a safty net token was passed, but no matching SHA256 was registered firebase console. Please make sure that this application’s package name/SHA256 pair is registered in the firebace console.’
    I check package name is correct and SHA1
    & SHA256 pasted.
    what is problem there. Please help me.

    Reply
  2. Pingback: com.google.firebase.auth.FirebaseAuthException: This request is missing a valid app identifier, meaning that neither SafetyNet checks nor reCAPTCHA checks succeeded. Please try again, or check the logcat for more details - Lynxbee, Embedded, Linux, Androi
  3. hi , I try to learn flutter and firebase , I have a problem with app check service in firebase, when I set SHA-256 and click to save it , firebase give a notification about :an error occurred when accepting terms of service, how can find why I faced this error

    Reply

Leave a Comment