flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

flutterfire_ui 0.4.0 Google Sign In Error on Android and macOS desktop

Open Splashman777 opened this issue 2 years ago • 19 comments

I upgraded flutterfire_ui from 0.3.6+1 to 0.4.0 and Google Sign In button no longer works. It always says "An unknown error occurred". I can't find anything in the logs for further info. Switched back to 0.3.6+1 and it works fine.

The only thing I could find while debugging was this: "com.google.android.gms.common.api.ApiException: 10: null". Sounds like I might have something set up wrong but I've only had a problem with this version so I'm confused.

Splashman777 avatar Apr 02 '22 22:04 Splashman777

yes Screen Shot 1443-09-03 at 1 13 45 AM

ghost avatar Apr 04 '22 01:04 ghost

yes Screen Shot 1443-09-03 at 1 13 45 AM

I have the old version It has no problems with google sign in

ghost avatar Apr 04 '22 01:04 ghost

I upgraded flutterfire_ui from 0.3.6+1 to 0.4.0 and Google Sign In button no longer works. It always says "An unknown error occurred". I can't find anything in the logs for further info. Switched back to 0.3.6+1 and it works fine.

The only thing I could find while debugging was this: "com.google.android.gms.common.api.ApiException: 10: null". Sounds like I might have something set up wrong but I've only had a problem with this version so I'm confused. Screen Shot 1443-09-03 at 5 05 57 AM

ghost avatar Apr 04 '22 02:04 ghost

The solution // Screen Shot 1443-09-03 at 5 29 40 AM

ghost avatar Apr 04 '22 02:04 ghost

Thanks for the report. Seeing the same using latest version. Verified this on Android device (S10).

stable, master flutter doctor -v

[✓] Flutter (Channel stable, 2.10.4, on macOS 12.2.1 21D62 darwin-x64, locale
    en-GB)
    • Flutter version 2.10.4 at /Users/dhs/documents/fluttersdk/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision c860cba910 (3 days ago), 2022-03-25 00:23:12 -0500
    • Engine revision 57d3bac3dd
    • Dart version 2.16.2
    • DevTools version 2.9.2

[!] Xcode - develop for iOS and macOS (Xcode 12.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    ! Flutter recommends a minimum Xcode version of 13.
      Download the latest version or update via the Mac App Store.
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] VS Code (version 1.62.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.21.0

[✓] Connected device (5 available)
    • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
    • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
      ios            • iOS 14.4.1 18D61
    • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
      ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
    • macOS (desktop)            • macos                                    •
      darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
    • Chrome (web)               • chrome                                   •
      web-javascript • Google Chrome 98.0.4758.80

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

[✓] Flutter (Channel master, 2.13.0-0.0.pre.366, on macOS 12.2.1 21D62
    darwin-x64, locale en-GB)
    • Flutter version 2.13.0-0.0.pre.366 at
      /Users/dhs/documents/fluttersdk/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 0b97874895 (2 days ago), 2022-04-01 21:20:01 -0400
    • Engine revision 801d8c530f
    • Dart version 2.17.0 (build 2.17.0-265.0.dev)
    • DevTools version 2.12.1

[!] Xcode - develop for iOS and macOS (Xcode 12.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    ! Flutter recommends a minimum Xcode version of 13.
      Download the latest version or update via the Mac App Store.
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] VS Code (version 1.62.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.21.0

[✓] Connected device (5 available)
    • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
    • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
      ios            • iOS 14.4.1 18D61
    • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
      ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
    • macOS (desktop)            • macos                                    •
      darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
    • Chrome (web)               • chrome                                   •
      web-javascript • Google Chrome 98.0.4758.80

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.



/cc @lesnitsky

Please disregard the Android platform replication. It was related to my SHA key and re-registering it got it working for me on Android. So this doesn't seem to be specific to mobile platform.

I can confirm this behavior on macOS wherein I am seeing 400 server response with Missing required paramter: scope.

darshankawar avatar Apr 04 '22 11:04 darshankawar

@Splashman777 what platform are you experiencing this issue?

lesnitsky avatar Apr 04 '22 11:04 lesnitsky

‫Macos

‫في ٠٤‏/٠٤‏/٢٠٢٢ الساعة ٢:٥٧ م، كتب/كتبت ‏Andrei Lesnitsky @.***>:‬

 @Splashman777 what platform are you experiencing this issue?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

ghost avatar Apr 04 '22 12:04 ghost

@Splashman777 com.google.android.gms.common.api.ApiException: 10: null seems to be related to your emulator not being linked to the firebase project. (see this SO question).

Could you please add your emualtor sha to the firebase project and try to sign in with google again?

lesnitsky avatar Apr 04 '22 12:04 lesnitsky

@lesnitsky Android. I have all my SHA keys set up in Firebase and everything has been working on other versions besides 0.4.0

Splashman777 avatar Apr 04 '22 15:04 Splashman777

I have a similar issue on macOS for both Google and Apple sign in.

talkbiz avatar Apr 19 '22 21:04 talkbiz

Strangely I'm getting the same "an unknown error has occurred" error message and I haven't moved off 0.3.6+1 but simply added the google_sign_in package, where previously I was only using email/password logins (which still work fine).

I should add I'm also on stable channel, using a Android 12 device and can confirm I have the debug SHA1 fingerprint added to my Firebase project config.

maks avatar Apr 20 '22 07:04 maks

Also getting an 'An unknown error occurred' with google_sign_in ^5.3.0 and flutterfire_ui ^0.4.0+2.

This occurs when Login with Google:

  1. click on Google login
  2. pick a Google account from the picker
  3. and then on the FlutterFire UI screen returns "unknown error"

Have now also tested with flutterfire_ui ^0.3.6+1 ... still the same issue.

workerbee22 avatar Apr 22 '22 11:04 workerbee22

I'm looking into it

lesnitsky avatar Apr 22 '22 11:04 lesnitsky

I encountered the same issue on Android after upgrading flutterfire_ui from 0.3.6+1 to 0.4.0+5.

This change may be the reason. The clientId parameter is now passed to the GoogleSignIn constructor, and because my GoogleProviderConfiguration uses the androidClientId value, it doesn't work. Hardcoding the web clientId value fixes the issue (it's actually what's specified in the docs), but on the other side, the docs of GoogleSignIn.clientId states that it is "Only supported on web".

etienn01 avatar May 11 '22 12:05 etienn01

@etienn01 Specifying the clientId does not work for me.

I'm using google_sign_in ^5.3.1 and flutterfire_ui ^0.4.0+5 I always have included the hard coded web clientId with my GoogleProviderConfiguration as well, because yes as you point out it has always said to use this clientId.

But still get the "An unknown error occurred" when using 'Sign in with Google'. Email/password sign in and Sign in with Apple both still working fine.

UPDATE: Have now upgraded to flutterfire_ui ^0.4.1 with Flutter v3, retested, but still have the same issue. UPDATE: Retested with flutterfire_ui 0.4.1+1 and Flutter v3, but still have the same issue.

workerbee22 avatar May 12 '22 23:05 workerbee22

I have the same issue. Google SignIn button works only with version of flutterfire_ui smaller than 4.0.0. In other case 'An unknown error occured' happens. IDE: Android Studio, google_sin_in: 5.3.0

7AveNooN7 avatar Jun 06 '22 16:06 7AveNooN7

Using flutterfire_ui version 0.4.2 I have the same issue debugging on 1)Samsung SM-G900V running Android 6.0.1, and 2)Samsung SM-G950U running Android 9. Same project runs on iPhone and iPad with no problems with Sign in with Google.

Flutter Doctor: [✓] Flutter (Channel stable, 3.0.4, on macOS 12.4 21F79 darwin-x64, locale en-US) [✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1) [✓] Xcode - develop for iOS and macOS (Xcode 13.4.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2021.1) [✓] VS Code (version 1.69.0) [✓] Connected device (3 available) ! Device emulator-5562 is offline. [✓] HTTP Host Availability

• No issues found!

@lesnitsky

prgtrdr avatar Jul 09 '22 16:07 prgtrdr

Update which shows we have a clear conflicting requirements around the id.

Trying to use SignInView I currently specify in my Google Provider Configs the clientId because it is required.

I'm using the latest:

google_sign_in ^5.4.0 flutterfire_ui ^0.4.3

Result when the app runs on Android is this warning: W/google_sing_in(13914): clientId is not supported on Android and is interpreted as serverClientId.Use serverClientId instead to suppress this warning.

So clientId is required by the const GoogleProviderConfiguration as part of passing providerConfigs to SignInView. But problem is that we don't yet have available to us serverClientId, although warning says it interprets clientId as serverClientId ? So kinda confusing.

workerbee22 avatar Jul 23 '22 06:07 workerbee22

I've just hit this and I think the warning is a red herring... Other than the normal 100million cleans, version changes and rebuilds, I did two things that eventually go this working again .

  1. APIs & Services > OAuth Consent Screen > Edit app... (There was a new email requirement and my scope were empty, I added "openid", "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile", and matched it in the GoogleProviderConfiguration)
  2. Nuked my Android Firebase configuration by deleting the SHA keys and re-inputting. This required a firebase configuration re-run and updated ios and android google configs.

Hopefully one of those two things helps the rest of you (I assume it's the first one). I believe there is a decent delay after changing the OAuth Consent Sceen, so give it an hour

MousyBusiness avatar Aug 21 '22 09:08 MousyBusiness