-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[google_sign_in] add serverAuthCode to GoogleSignInAccount #4180
[google_sign_in] add serverAuthCode to GoogleSignInAccount #4180
Conversation
Thanks for the contribution!
Same question here as in the other PR; I'm not seeing these tests in the PR. |
I've fixed the title, but this was not the case:
Please keep in mind for future submissions that the checklist is to help make sure all the important steps are followed; just checking all the boxes without doing the steps causes PRs to take longer to triage and review. |
fixed |
Just in case clarification here too. I've removed serverAuthCode from getToken response because that was wrong - android/ios native response doesn't contain serverAuthCode field And I've added serverAuthCode to user data response according to my changes because serverAuthCode obtained on that step |
packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart
Outdated
Show resolved
Hide resolved
Ok, serverAuthCode property now moved from tokens response to signIn response |
Hi @cyanglaz |
@cyanglaz please let me know if you need anything else. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Post-submit LGTM (with one question), since this should have had two approvals before landing.
@@ -350,7 +351,8 @@ void main() { | |||
|
|||
expect(auth.accessToken, '456'); | |||
expect(auth.idToken, '123'); | |||
expect(auth.serverAuthCode, '789'); | |||
// fix deprecated_member_use_from_same_package | |||
// expect(auth.serverAuthCode, '789'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was commented-out code checked in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, sorry I should have caught it. I'll create a PR to remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a new policy that we are enforcing for the whole repo? (All PRs need at least 2 approvals before landing) |
* master: [webview] Fix typos in the README (flutter#4249) [google_sign_in] add serverAuthCode to GoogleSignInAccount (flutter#4180) [ci] Update macOS Cirrus image to Xcode 13 (flutter#4429) [shared_preferences] Switch to new analysis options (flutter#4384) [flutter_plugin_android_lifecycle] remove placeholder dart file (flutter#4413) [camera] Run iOS methods on UI thread by default (flutter#4140) [ci] Always run all `format` steps (flutter#4427) [flutter_plugin_tools] Fix license-check on Windows (flutter#4425) [google_maps_flutter] Clean Java test, consolidate Marker example. (flutter#4400) [image_picker][android] suppress unchecked warning (flutter#4408) [ci] Replace Firebase Test Lab deprecated Pixel 4 device with Pixel 5 (flutter#4436) [image_picker_for_web] Added support for maxWidth, maxHeight and imageQuality (flutter#4389) Bump compileSdkVersion to 31 (flutter#4432) [camera] Update [CameraOrientationTests testOrientationNotifications] unit test to work on Xcode 13 (flutter#4426) Update integration_test README (flutter#3824) [webview_flutter] Adjust test URLs again (flutter#4407) [google_sign_in] Add serverAuthCode attribute to google_sign_in_platform_interface user data (flutter#4179) [camera] Add filter for unsupported cameras on Android (flutter#4418)
There's a new-ish policy for all Flutter repos that all PRs need the involvement of two commiters: https://github.com/flutter/flutter/wiki/Tree-hygiene#getting-a-code-review second paragraph. |
* master: [webview] Fix typos in the README (flutter#4249) [google_sign_in] add serverAuthCode to GoogleSignInAccount (flutter#4180) [ci] Update macOS Cirrus image to Xcode 13 (flutter#4429) [shared_preferences] Switch to new analysis options (flutter#4384) [flutter_plugin_android_lifecycle] remove placeholder dart file (flutter#4413) [camera] Run iOS methods on UI thread by default (flutter#4140) [ci] Always run all `format` steps (flutter#4427) [flutter_plugin_tools] Fix license-check on Windows (flutter#4425) [google_maps_flutter] Clean Java test, consolidate Marker example. (flutter#4400) [image_picker][android] suppress unchecked warning (flutter#4408) [ci] Replace Firebase Test Lab deprecated Pixel 4 device with Pixel 5 (flutter#4436) [image_picker_for_web] Added support for maxWidth, maxHeight and imageQuality (flutter#4389) Bump compileSdkVersion to 31 (flutter#4432) [camera] Update [CameraOrientationTests testOrientationNotifications] unit test to work on Xcode 13 (flutter#4426) Update integration_test README (flutter#3824) [webview_flutter] Adjust test URLs again (flutter#4407) [google_sign_in] Add serverAuthCode attribute to google_sign_in_platform_interface user data (flutter#4179) [camera] Add filter for unsupported cameras on Android (flutter#4418) # Conflicts: # packages/webview_flutter/webview_flutter/CHANGELOG.md # packages/webview_flutter/webview_flutter/pubspec.yaml
* master: (364 commits) Use OpenJDK 11 in CI jobs (flutter#4419) [google_sign_in] remove the commented out code in tests (flutter#4442) [webview] Fix typos in the README (flutter#4249) [google_sign_in] add serverAuthCode to GoogleSignInAccount (flutter#4180) [ci] Update macOS Cirrus image to Xcode 13 (flutter#4429) [shared_preferences] Switch to new analysis options (flutter#4384) [flutter_plugin_android_lifecycle] remove placeholder dart file (flutter#4413) [camera] Run iOS methods on UI thread by default (flutter#4140) [ci] Always run all `format` steps (flutter#4427) [flutter_plugin_tools] Fix license-check on Windows (flutter#4425) [google_maps_flutter] Clean Java test, consolidate Marker example. (flutter#4400) [image_picker][android] suppress unchecked warning (flutter#4408) [ci] Replace Firebase Test Lab deprecated Pixel 4 device with Pixel 5 (flutter#4436) [image_picker_for_web] Added support for maxWidth, maxHeight and imageQuality (flutter#4389) Bump compileSdkVersion to 31 (flutter#4432) [camera] Update [CameraOrientationTests testOrientationNotifications] unit test to work on Xcode 13 (flutter#4426) Update integration_test README (flutter#3824) [webview_flutter] Adjust test URLs again (flutter#4407) [google_sign_in] Add serverAuthCode attribute to google_sign_in_platform_interface user data (flutter#4179) [camera] Add filter for unsupported cameras on Android (flutter#4418) ... # Conflicts: # packages/google_maps_flutter/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java
…ideo_src_on_same_controller * commit '76e84c0679dbab7bfaaaa553b17bb0dbdb9a3c33': (537 commits) [video_player] Initialize player when size and duration become available (flutter#4438) [webview_flutter] Implement zoom enabled for ios and android (flutter#4417) Partial revert of "upgraded usage of BinaryMessenger (flutter#4451)" (flutter#4453) Implement Android WebView api with pigeon (Java portion) (flutter#4441) [in_app_purchase] Update to the latest pkg:json_serializable (flutter#4434) Implement Android WebView api with pigeon (Dart portion) (flutter#4435) upgraded usage of BinaryMessenger (flutter#4451) [flutter_plugin_tools] Fix pubspec-check on Windows (flutter#4428) Use OpenJDK 11 in CI jobs (flutter#4419) [google_sign_in] remove the commented out code in tests (flutter#4442) [webview] Fix typos in the README (flutter#4249) [google_sign_in] add serverAuthCode to GoogleSignInAccount (flutter#4180) [ci] Update macOS Cirrus image to Xcode 13 (flutter#4429) [shared_preferences] Switch to new analysis options (flutter#4384) [flutter_plugin_android_lifecycle] remove placeholder dart file (flutter#4413) [camera] Run iOS methods on UI thread by default (flutter#4140) [ci] Always run all `format` steps (flutter#4427) [flutter_plugin_tools] Fix license-check on Windows (flutter#4425) [google_maps_flutter] Clean Java test, consolidate Marker example. (flutter#4400) [image_picker][android] suppress unchecked warning (flutter#4408) ... # Conflicts: # packages/video_player/video_player/pubspec.yaml # packages/video_player/video_player_web/lib/video_player_web.dart # packages/video_player/video_player_web/pubspec.yaml
Thanks for the fix. Somehow I am still getting null serverAuthCode. Is this change already pushed in latest published package for google_sign_in? Also, are you aware of any ongoing or past fix for ios for this scenario? I am integrating google sign in for my app and need both these fixes. Will appreciate any help :) |
You need to specify correct server client id to get serverAuthCode. Please ensure you have it in SERVER_CLIENT_ID(iOS) and default_web_client_id(Android). For android you also can pass value directly into plugin constructor |
Thanks for the quick tip @p-shapovalov . I made the changes but it keeps crashing everytime google sign in opens in ios after account selection. Strangely, the exception is not throw in the console but the device keeps disconnecting. I believe its a config issue but I am not able to put a finger on it. So sharing the details here, please let me know if you notice anything that needs to change in the way I am using/configuring the plugin:
|
I'm not sure what exactly wrong with your configuration, because I didn't use google sign in for ios, I guess you can try to catch exception somewhere in https://github.com/flutter/plugins/blob/master/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart#L376 However according to your sample
Please check deprecation warning and use account.serverAuthCode instead |
Please do not use PRs for support requests. |
@jainkrati I initially had the same problem as you. (My implementation is very similar to yours) Then I realized that my |
Thanks @tylerstephens814 :) Yesterday even I got google sign in working on ios by fixing two issues:
|
Description
Reuse serverAuthCode obtained on login in /pull/4179
Related issues
flutter/flutter#57712
flutter/flutter#57741
Pre-launch Checklist
dart format
.)[shared_preferences]
///
).Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?