2

I'm developing a flutter app which includes google sign in with firebase. Google sign in is working perfectly on emulator but when I export signed bundle and test on physical device. It doesn't work. Is there anything I need to add in gradle file? Can someone please guide me?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807

5 Answers5

2
  1. Add SHA1 and SHA256 keys in your firebase project, also add proper email id in the project setting while setting up the SHA keys.
  2. Download the google-services file again
  3. Rebuild the project
  4. If you're planning to release the app on play store then you need to setup OAuth.
sungkd123
  • 383
  • 1
  • 8
  • I've already added keys in there. But, I haven't setup OAuth. Can you please guide me how to do that? Thank you very much. – Hamza Kaleem Jun 13 '21 at 15:26
  • This will help for OAuth and playstore related setup for your app. https://stackoverflow.com/questions/54557479/flutter-and-google-sign-in-plugin-platformexceptionsign-in-failed-com-google/54696963#54696963 This link will be helpful for OAuth and Credentials https://console.developers.google.com/apis/credentials/consent/edit – sungkd123 Jun 13 '21 at 15:31
2

This happens because the SHA1 and SHA256 for release and debug are different.

So since we have added only the debug keys, we also need to add the release keys.

For that we need to open Google Play Console > (Click on your App) > Setup in Left Pane > App Integrity

There you will get App signing key certificate and Upload key certificate

Copy the SHA1 and SHA256 from both keys and paste in Firebase Project under Project Settings.

enter image description here

Madhav Kumar
  • 856
  • 8
  • 19
2

Goto Play store and Search for "App Integrity"

Google play store app integrity

Then
Copy the SHA Keys and Add into the Firebase signing keys.

and then you are good to go.

Sayed Muhammad Idrees
  • 1,245
  • 15
  • 25
1

You need to add the release sha-1 to Firebase. Run signing report in Android Studio to get the sha-1 and add it to your Firebase project under Project Overview settings.

Scott
  • 371
  • 4
  • 8
1

I figured out a solution for it. Actually the Google sign in was not working after I upload it to google play and then install it as a tester. Problem was that the Google play generates different SHA1 and SHA256 keys. But, I had only added the keys from Android Studio and this was causing a problem. I got the problem solved when I found SHA1 and SHA256 keys from Google play app and added them to firebase. Thank you very much to the respected people who tried to help.

  • did you add keys you got from google play with the keys you generated from android studio OR remove the old ones and only put keys from the play store ... please help me. – Anmol Shah Nov 17 '21 at 18:35
  • We don't need to remove anything, just add the new keys – Madhav Kumar Dec 25 '21 at 15:07