Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Authentication - Phone - "INVALID_CERT_HASH"

The following error is occur when I try to run the phone authentication in the local android device.

[GetAuthDomainTask] Error getting project config. Failed with {
E/FirebaseAuth(25345):   "error": { 
E/FirebaseAuth(25345):     "code":400, 
E/FirebaseAuth(25345):     "message": "INVALID_CERT_HASH",
E/FirebaseAuth(25345):     "errors": [ E/FirebaseAuth(25345):       {
E/FirebaseAuth(25345):         "message": "INVALID_CERT_HASH",
E/FirebaseAuth(25345):         "domain": "global",
E/FirebaseAuth(25345):         "reason": "invalid"
E/FirebaseAuth(25345):       } 
E/FirebaseAuth(25345):     ]
E/FirebaseAuth(25345):   } 
E/FirebaseAuth(25345): }

I have refer to stackoverflow comment. But I do stated my SHA-1 and SHA-256 in the project. Since my SHA-1 and SHA-256 is existing, I run the command below in the keystore located folder. Everything is seen normal. Can anyone show what have I miss out?

keytool -list -v -keystore my_keystore.jks

like image 518
CLKH Avatar asked Nov 27 '20 16:11

CLKH


People also ask

How do I use Firebase Authentication on my phone?

Create fictional phone numbers and verification codes In the Firebase console, open the Authentication section. In the Sign in method tab, enable the Phone provider if you haven't already. Open the Phone numbers for testing accordion menu. Provide the phone number you want to test, for example: +1 650-555-3434.

Is phone Auth free in Firebase?

Prices are per successful verification. On the Blaze plan, Phone Authentication provides a perpetual free tier. The first 10K verifications for both instances (USA, Canada, and India and All other countries) are provided for free each month. You are only charged on usage past this free allotment.

How do I remove Captcha verification from Firebase phone auth using Android?

Don't forget to go in Firebase Project Settings > App check > and Register firebase project in SafetyNet and Play Integrity register with default time token 1 hour and u will remove reCaptcha from phone auth OTP! That's awesome.


1 Answers

To solve this error, you need to add both your keystore SHA1 and SHA56 as well as debug SHA1 and SHA256 to fireabse console.

That means two SHA1 and two SHA256

For debug keys use https://developers.google.com/android/guides/client-auth?authuser=1 to get the key, use ./gradlew signingReport or .\gradlew signingReport if in windows to get debug keys.

For release keys use Keystore explorer to see the SHA1 and SHA256.

If the issue persists after changing your SHA1 and SHA256 make sure the following:

  1. Change the google-services.json file again.
  2. Delete the app in settings and add a new one with the right SHA1
like image 124
Rohit Mahto Avatar answered Oct 25 '22 17:10

Rohit Mahto