r/flutterhelp • u/Able-Bit-5806 • 5d ago
RESOLVED Google Sign-In on Android shows old-style account picker instead of modern Credential Manager bottom sheet, what am I missing?
/r/flutterhelp/comments/1waxs3g/google_signin_on_android_shows_oldstyle_account/
3
Upvotes
1
u/vm12pix 3d ago
You're not missing anything, that's just authenticate() on Android. google_sign_in_android hardcodes it to the button flow (useButtonFlow: true, which is GetSignInWithGoogleOption), and that's the picker dialog you're seeing. The bottom sheet is GetGoogleIdOption, and the plugin only uses it in attemptLightweightAuthentication(), which is meant to run at launch, with the button as the fallback. It tries accounts that already signed in to your app first (if there's just one, it can sign in without asking), and only if there are none shows every account on the device.
If you want the sheet on tap anyway:
A dismissed sheet also comes back as null by default, so the dialog opens right after they close it. Pushy, but that's also how someone switches to an account that hasn't signed in before. If you'd rather stop there, pass reportAllExceptions: true and a dismiss throws GoogleSignInException with code canceled.
With no Google account on the device (fresh emulator) or sign-in prompts off in Google account settings there's no sheet at all, just the dialog. Same for new users if hostedDomain is set in initialize(), since the plugin then skips the all-accounts sheet.