Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter app - Google sign in doesn't work after publishing to PlayStore

I use Firebase authentication with google_sign_in for my CrossPlatform Mobile app that's been developed with Flutter framework.

The problem :

  • When I press the login button on the published app to log in I get the following exception :
Platformexception(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null, null) 

Notes :

  • No problems are visible when I run 'flutter doctor -v'
  • It works completely well on Ios and on debug / release mode when I run it from my computer on my phone, but the published version is not working. (flutter run, flutter run --release)
  • I use app signing provided by google

What I've tried so far :

  • I've already added the app-signing SHA1 and SHA256 keys from Play Store's console and the upload and release keys from my upload-keystore.jks to Firebase APP
  • I've tried to recreate my Firebase Android app, readding google-service.json
  • I've added this part to my build.gradle to test if the default shrinking is the problem :
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled false
shrinkResources false
}
}

I know this error is most likely relatd to SHA keys, so if somebody could explain which SHA1 & SHA256 Keys should be added and exactly how should I generate them, that would be nice also, just to exclude that possibility completely. Also I'd be grateful for any other insights.

like image 629
Diák Dezső Avatar asked Sep 10 '25 18:09

Diák Dezső


2 Answers

Google uses Automatic App Signing by default, which means that your SHA-key will change after you upload to Google Play.

To find the new key, go to the Play console > Setup > App Integrity > App Signing (or click on this link: https://play.google.com/console/developers/app/keymanagement).

You will find three keys there: MD5, SHA-1 and SHA-256.

Now you just have to add those keys in the Firebase console under Project settings > General.

like image 90
Linus Sorg Avatar answered Sep 13 '25 10:09

Linus Sorg


With iOS, you don't need to care about adding sha key

With Android, I think mostly you've missed adding sha app signing key

When you run your project (both debug & release mode), this behavior is the same you install an APK to the device, and local keystore (also called upload keystore - the key you generated by yourself) is fine in this case

But when you install your app from Google Play (or internal testing or whatever through Google Play), google uses app signing key to sign your app (not your upload keystore) like image below, so miss adding this sha key will cause the error enter image description here

-> Solution: find your app signing key on the dashboard like the image below and add it to your config

enter image description here

like image 42
Quang Duy Tran Avatar answered Sep 13 '25 09:09

Quang Duy Tran



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!