Google sign in not working after publishing in play store

AndroidFirebaseFirebase AuthenticationGoogle Signin

Android Problem Overview


I went through this, and as far as the process goes I did that.

But I when I installed the app from play store I am not able to sign in using the google sign in button.

I have used Firebase for google sign in. When I am clicking the sign in button the option to choose the account is coming but then it is not signing in or doing anything.

So where possibly am I going wrong?

Android Solutions


Solution 1 - Android

When you upload an apk to the play store then play store creates a new SHA1 key called "App signing certificate". You get that SHA1 and save in your console or firebase account (as you need).

New SHA1 will be found at Released Management->App Sigining on your play console.

[enter image description here]

Solution 2 - Android

Update: Google changed behaviour of uploading APK, check answer below!

Release APK and debug APK has different SHA1 and different API keys for google services. Both of them must be added in Firebase Console -> Project settings. Then download google-services.json from here, add it to project and recompile with release keystore using option "Build signed APK". That should work

Solution 3 - Android

The problem was created when Google Play App Signing was enabled for my app. Google Play App Signing changes the SHA-1 certificate fingerprint (from what is in my keystore) to their own SHA-1 certificate fingerprint.

The fix:

  1. Goto https://play.google.com/apps/publish/
  2. Click your application >> Release Management >> App Signing.

> You will see "App signing certificate" and "Upload certificate"

  1. Copy the SHA-1 From "App Signing Certificate." (THE TOP ONE)
  2. Goto https://console.firebase.google.com/
  3. Click your application >> Settings [Gearbox Icon to the right of project overview] (top of the screen) >> Project Settings >> General [Tab] >> Add Fingerprint
  4. Paste the SHA-1 App Signing Certificate. Save.

All fixed!

Solution 4 - Android

There are three types of SHA1 is required for an app lifecycle when you are using firebase

  • -debug SHA1
  • -release SHA1
  • -signing SHA1 (it getting from play store)

You need to add signing SHA1 to firebase after publish your application here i am attaching two screen shots please have a look . The red marked certificates is must be required, so copy it from playstore and paste it on firbase enter image description here

enter image description here

In firebase paste here

Solution 5 - Android

Issue happens because

  1. when you create / publish an app through google play console, there is an option for enable Google Play App Signing. if you enable it will show

> Google Play App Signing is enabled for this app.

enter image description here

then your Upload certificate details will change and you need to rewrite SHA-1 etc. certificate details in respective places.

  1. You provided debug key store / SHA-1 certificate details instead of RELEASE certificate details

  2. error while generating certificates.

Solution

  1. Go to google play console

Relese management -> App signing

then you can see two types of certificate

1- Upload certificate ( your app certificate provided when generating signed apk)

2- App signing certificate ( because you enabled Google Play App Signing, so they provided new certificate details for your published apk)

> you need to change uploaded certificate details with new details > provided by google play where ever you used it before. such as > Integrating google sign in (change SHA-1 of OAuth client), > facebook login (change key Hash (generate key hash using SHA-1 > use this link or copy the key hash provided by facebook login > error screen), firebase etc.

  1. provide release SHA-1 / keyHash

create / use Keystore details of signed apk.

using command prompt:

google / firebase SHA-1 :

keytool -exportcert -keystore path-to-debug-or-production-keystore -list -v

facebook release key hash:

keytool -exportcert -alias <user alias name> -keystore < keystore path> | <openssl-path> sha1 -binary | <openssl-path> base64   
  

if asked for password enter your signed apk keystore password.

Solution 6 - Android

In the latest Google play console 2021:

QUICK GUIDE:

Application Play console > Setup > App Integrity

OR
Search App Integrity in application's Search box

DETAILED GUIDE:

Step 1: Go to https://play.google.com/console/u/3/developers and open your application's Dashboard

Step 2: On the left sidebar under Release, select Setup, then App Integrity.

Optional: You could also simply search App Integrity in the Search.

enter image description here

Solution 7 - Android

To add on existing responses, once you have the newly created SHA1:

Goto https://console.firebase.google.com:

  1. Select project
  2. Project Overview
  3. Project Settings
  4. ADD FINGERPRINT - enter SHA1 to Certificate fingerprint
  5. Save

Solution 8 - Android

If someone is not able to solve this issue then just open Setup > app integrity in the console and then copy the SHA1 and paste in your firebase console.

enter image description here

Solution 9 - Android

In case of anyone facing this issue after Aug 2020. New SHA1 can be found at Setup->App Signing on your play console. Everything else is the same as @PrinkalKumar as answered.

Solution 10 - Android

in new version of the google console:

Setup > app integrity

Solution 11 - Android

If you enabled "Google Play App Signing" when publishing your app, you are now probably dealing with two fingerprints:

The one coming from your local keystore (keytool -exportcert -keystore path-to-production-keystore -list -v), known as the "upload cert".

The new one generated by Google when you enabled Signing (the "signing certificate").

The conflict with this situation, is that you may end up with two OAuth 2.0 client IDs:

  • The one that you created before publishing your app (and before enabling google signing), which is indeed the "right" one.

  • A NEW one created by Google when you enabled Google Signing.

You can verify this fact from: Google Play Console -> Games Services -> Select your App -> Games Details -> API Console project -> Credentials -> OAuth 2.0 client IDs

SOLUTION

In order for Google Sign-in (and all related Games Services features) to work, I had to correct the fingerprint for my pre-existing OAuth2 Client ID (the one that I created before publishing my app).

  1. Look for the "right" OAuth 2.0 client ID: Google Play Console -> Games Services -> Select your App -> Linked Apps --> Select your App --> Take note of the "OAuth2 Client ID" at the bottom.

  2. Look for the "Signing" certificate: Google Play Console -> Games Services -> Select your App -> Game Details -> API Console project -> Credentials -> OAuth 2.0 client IDs --> "Android client for XXXXXX (auto created by Google Service)" --> Take note of the value (xx:xx:xx:etc....) Comment: In order to reuse this value in my other OAuth 2.0 client ID, I had to replace it with some dummy number. Otherwise, you will get error: "Certificate already used in some other project".

  3. Go to your pre-existing OAuth2 Client ID: Google Play Console -> Games Services -> Select your App -> Games Details -> API Console project -> Credentials -> OAuth 2.0 client IDs --> Select "OAuth 2.0 client ID" from step 1. Update certificate value with the one from step 2.

This solved my issue. Multiplayer is working perfectly in my app (Match4App).

Solution 12 - Android

just goto the google play console > liked account and link your firebase project. Now it works fine!

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionarqamView Question on Stackoverflow
Solution 1 - AndroidPrinkal KumarView Answer on Stackoverflow
Solution 2 - AndroidDima RostopiraView Answer on Stackoverflow
Solution 3 - AndroidAlan NelsonView Answer on Stackoverflow
Solution 4 - AndroidMuhammed FasilView Answer on Stackoverflow
Solution 5 - AndroidAdarsh Vijayan PView Answer on Stackoverflow
Solution 6 - AndroidBrianView Answer on Stackoverflow
Solution 7 - AndroidRonTLVView Answer on Stackoverflow
Solution 8 - AndroidShivam YadavView Answer on Stackoverflow
Solution 9 - AndroidtsvillainView Answer on Stackoverflow
Solution 10 - AndroidRyan TafakoriView Answer on Stackoverflow
Solution 11 - AndroidPablo AlfonsoView Answer on Stackoverflow
Solution 12 - AndroidShehan Rashmika PereraView Answer on Stackoverflow