iroyo
iroyo

Reputation: 763

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.

Upvotes: 9

Views: 4043

Answers (4)

Suraj Sisodia
Suraj Sisodia

Reputation: 11

You might have enabled Play App Signing, which is recommended by Google Play to have it enable if you want to upload an app bundle.

  1. Go to your app's dashboard page.
  2. In the side(left) drawer menu, Release -> Setup -> App integrity

There you'll find SHA-1 & SHA-256 keys. Just copy them and paste them into your Firebase Project.

  1. Open your Firebase project.
  2. Project Settings(right side of Project Overview, cog icon).
  3. Select your app.
  4. Add Fingerprint and paste your keys here.

Make sure to add both SHA-1 and SHA-256 keys.

Upvotes: 1

Ram Chhabra
Ram Chhabra

Reputation: 441

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.

Upvotes: 8

Yeuni
Yeuni

Reputation: 282

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.

Upvotes: 1

Kiran Maniya
Kiran Maniya

Reputation: 9009

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

Upvotes: 1

Related Questions