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,

Related :   Shell script to check if Android device is connected over USB

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.


lynxbee_ezoic

Subscribe with Valid Email Id to receive updates in Inbox. ( Secured by Google FeedBurner )

   


3 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

Leave a Comment

Android Android Applications Android Build system Android Commands Application Libraries Application Stack / User Interface Bash / Shell Scripts Bluetooth driver Cloud Technologies Commands and Packages Compilation Content Management System Core Kernel C Programs Development & Build Development, Debugging and Performance Tools Development Environment Setup Django & REST Api Errors & Failures Git Hardware Platforms HTML JAVA Programs Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Multimedia Audio, Video, Images NDK / Middleware / HAL OS Concepts PHP Programming Languages Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Source Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Web design and development Website Hosting Wordpress Yocto / Bitbake / Openembedded