Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Phone Auth not working when published (Android)

The phone authentication works when using the debug version of my app and also works when I manually install the release-signed apk on a phone. But when I publish the same working apk to Play Store (Alpha Testing) I can't make it to work. After digging a bit a got this:

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 ]

I know what it looks like. But I can assure I've added the correct SHA-1 into Firebase console and check it before publication.

My questions: Is there something else I should look at? I've also double checked the google-services.json with no success.

like image 896
iroyo Avatar asked Jan 18 '18 15:01

iroyo


People also ask

How do I enable Android verification for Firebase project in?

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.

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.

Is phone Auth free in Firebase?

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


Video Answer


3 Answers

You might have been using google play signing so just need to copy SHA1 from your play store console (under Release Management -> App Signing) to firebase console ( project settings -> Add fingerPrint ).

I was facing the same issue and it works for me.

like image 114
Ram Chhabra Avatar answered Oct 07 '22 18:10

Ram Chhabra


You have to add the release build application SHA-1 to the firebase. Go to firebase console. Open Project Settings Project Settings

Then open the Application

Update the SHA-1 certificate

To get your SHA-1 checksum for release app,

  1. Select Gradle in android studio from right panel
  2. Select Your App
  3. In tasks > android > signingReport and sha1 generation in android studio:

change firebase project setting

Press add fingerprint button

Select Gradle in android studio from right panel

Select Your App

In tasks -> android-> signingReportDouble click signingReport. You will find the sha1 fingerprint in the Gradle Console add this sha1 fingerprint in firebase console Gradle Toolbar

like image 35
Kiran Maniya Avatar answered Oct 07 '22 17:10

Kiran Maniya


After spending the whole Day figuring out what was the issue. I’ve found the culprit! It was in the App Signing for Google Play that we have opted-in.We need to register the SHA-1 from the App Signing itself. It can be found in the inside Google Play Console under Release Management > App Signing. It will have two types of certificate:

1.Upload certificate: this is the information of the certificate from the keystore that uploaded. This is needed to be the same with the keystore for app signing locally as the Google Play will verify the uploaded app to match with this signed certificate.

2.App Signing certificate: after uploaded the app, Google will replace the upload certificate with this certificate. This is a new certificate that will be used for published app in Play Store.

With those information, I just realize that we hadn’t registered the SHA-1 for the App Signing certificate which being used by published app. So, I added the SHA-1 (also the SHA-256, just in case needed) fingerprints in the Firebase > Project Setting for the app (Don’t forget to update the latest config file after added the fingerprints).

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

enter image description here

Now click save and Try to run your App it will work fine.

like image 34
Yeuni Avatar answered Oct 07 '22 18:10

Yeuni