Anh Tran dev notes

Production bugs from mobile and backend work, written up with the fix and how it was checked.

Note 20 / Android / Auth / Flutter

Google Sign-In works from my build but silently fails on the Play Store version: the app signing SHA-1

Pick an account, land back on the login screen, no error. Play re-signs the app, so the Android OAuth client needs the app signing key SHA-1. How I found it and checked it.

By
Trần Thế Anh, Software Engineer
Published
Work done
October 2026, AI Note Taker (Flutter, Android)
Stack
Flutter, google_sign_in 7.x (Credential Manager), Google Cloud OAuth clients, Google Play App Signing
Reading
7 min, 1,408 words

The first internal-testing build of AI Note Taker reached a real phone through Google Play. I tapped “Continue with Google”, the system sheet listed my account, I picked it, and the app showed the login screen again. No toast, no dialog, nothing in the app’s own error handling. The same code signed in without trouble from a debug build and from a release APK I had built and signed myself. This note is about why those two facts do not contradict each other, what the logs said, and the check I now run before the first Play release of any app with Google Sign-In.

What the phone actually logged

Because the app printed nothing, I read the device log while repeating the tap. Two lines from Google Play services mattered: one saying the Android application is “not registered to use OAuth2.0”, and one saying [16] Account reauth failed. The first line is the useful one. It says Google looked up the app by identity and found no OAuth client that matches.

You may know this failure under another name. With the older Google Sign-In SDK the same configuration mistake surfaces as DEVELOPER_ERROR, status code 10, and many forum answers are keyed on that string. The app here uses google_sign_in 7.x, which the package changelog describes as switching to Sign in with Google through Credential Manager (version 7.0.0 of google_sign_in_android). On that path I did not get a code 10 in Dart at all. A comment in my own code even predicted DEVELOPER_ERROR, and the prediction was wrong for this stack. If you search your logs for code 10 and find nothing, that does not mean the configuration is fine.

Why the app showed nothing

The Dart side of the sign-in call looks roughly like this, rewritten from the real helper:

try {
  final account = await GoogleSignIn.instance
      .authenticate(scopeHint: const ['email']);
  return account.authentication.idToken;
} on GoogleSignInException catch (e) {
  if (e.code == GoogleSignInExceptionCode.canceled) return null;
  throw SocialSignInUnavailable('${e.code.name}: ${e.description}');
}

A null means “the user closed the sheet”, and the login screen treats it as a non-event. That is the right behavior for a user who backs out. The trouble is that a misconfigured client also ends up as a cancellation. A comment I wrote in the login screen records what I saw on 5 October 2026: Play services return RESULT_CANCELED when the OAuth client does not match the package or the SHA-1, and AndroidX turns both cases into the same GetCredentialCancellationException. I have not traced the plugin’s mapping myself beyond that; what I can say is that the app could not tell the two apart, and the observed behavior was “account chosen, back to login, no message”.

The app now records a non-fatal event on every null token, with the reason auth:google-canceled. A spike of that label in the crash dashboard means the Google configuration just broke, not that many users changed their minds. Treat that as a monitoring heuristic, not a diagnosis; it has fired for me only as a smoke alarm.

Why my own build worked

On Android, Google identifies the caller by package name plus the SHA-1 fingerprint of the certificate that signed the installed APK. The Google Cloud console lets you create an Android OAuth client with exactly those two fields, and the Google help page for managing OAuth clients describes them as the package name and the SHA-1 fingerprint.

Now count the certificates involved. A debug build is signed with the debug keystore on the machine that built it. A release APK I sign myself carries my upload key. A build delivered by Google Play carries a third one. Google’s Play App Signing documentation describes two keys: the upload key, which you keep and use to sign the bundle you upload, and the app signing key, which Google holds and uses to sign the final APKs delivered to users’ devices. The same page says that because Google re-signs the app, you must register the app signing key’s fingerprint with API providers, and it names Google Cloud as an example. It also tells you where to read the fingerprint: the app signing page in Play Console, in the “App signing key” section.

My project had two Android clients, one for the debug key and one for the upload key. A comment in the code, written when I set the clients up, said two were enough. They are enough for every build I install myself and for none of the builds Play installs. The tester’s phone had the app signing key’s certificate, which matched no client, hence “not registered to use OAuth2.0”.

Measuring instead of guessing

The temptation is to open Play Console, copy a fingerprint, paste it into the console and hope. I preferred to read the SHA-1 off the installed app, because that is what Google sees. The check is a small shell script around adb and apksigner: it finds the installed base APK, pulls it, prints the signer’s SHA-1, and reads the installer package name from dumpsys package. An installer of com.android.vending means the build came from Play, so the SHA-1 is the Play app signing key. The script then compares that SHA-1 with a list of fingerprints already declared in the console and prints a pass or a “missing” line.

Two details cost me time. First, apksigner verify on an APK from Play reported DOES NOT VERIFY. The APK carries a newer signature block that this build-tools version cannot read; passing --max-sdk-version 36 made it print the certificate. The “Source Stamp Signer” line in that output belongs to the Play Store, not to the app, and is not the fingerprint to register. Second, the console’s client list shows truncated client ids and no fingerprints, so you have to open every Android client to see which SHA-1 it holds.

On my Xiaomi test phone the Play-installed build (version code 32) reported a SHA-1 that appeared in none of the existing clients. That was the evidence I wanted before changing anything.

The fix, and what it did not need

I created a third Android OAuth client in the same Google Cloud project as the web client that the backend uses for serverClientId, with the app’s package name and the Play app signing SHA-1. No new build, no new upload. The first failing attempt was at 10:52; with the new client in place, at 11:03 the same Play-installed build signed in and opened the home screen, and the “not registered” line was gone from the log. Google’s pages I read give no timing for Android client changes. My own checklist says to allow a few minutes for a new client to take effect, and my two timestamps are consistent with that, but they are one observation, not a guarantee.

A related trap: Google matches the pair, so check the package name as well as the SHA-1 when you compare. A note in my checklist also says that adding a SHA-1 to the Android app in Firebase does not create an OAuth client for you; I create the client in the Google Cloud console.

The rule I kept

An app that ships through Play with Google Sign-In needs one Android OAuth client per signing certificate that can reach a user: the Play app signing key, the upload key, and the debug key. Before the first Play release, install the build from Play on a real phone and run the comparison; “it signs in on my dev machine” proves nothing about the Play build.

I also scanned my other Flutter projects for google_sign_in in pubspec.yaml to see which ones had the same exposure. I am not naming them here because I only checked the dependency, not their consoles. On this app the end-to-end check passed after the new client existed: the Play-installed build reached the home screen. I have not repeated it for each later release, so the guarantee is only as good as the signing keys staying the same. If you opt into a new app signing key, the new fingerprint needs the same treatment.

Sources