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.

Leave a Comment