-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[google_sign_in_web] Migrate to the GIS SDK. #6921
[google_sign_in_web] Migrate to the GIS SDK. #6921
Conversation
f69101f
to
3055319
Compare
ebeeafa
to
2e6339b
Compare
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.
Some quick self-review.
packages/google_sign_in/google_sign_in_web/example/integration_test/utils_test.dart
Outdated
Show resolved
Hide resolved
packages/google_sign_in/google_sign_in_web/example/integration_test/utils_test.dart
Outdated
Show resolved
Hide resolved
packages/google_sign_in/google_sign_in_web/lib/src/gis_client.dart
Outdated
Show resolved
Hide resolved
@@ -3,7 +3,7 @@ description: Flutter plugin for Google Sign-In, a secure authentication system | |||
for signing in with a Google account on Android, iOS and Web. | |||
repository: https://github.com/flutter/plugins/tree/main/packages/google_sign_in/google_sign_in_web | |||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22 | |||
version: 0.10.2+1 | |||
version: 0.11.0 |
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.
Major version bump.
I think the |
0f708c8
to
6649796
Compare
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.
Great tests!
The code looks good to me, and I trust that you are using the GIS API correctly :)
packages/google_sign_in/google_sign_in_web/example/integration_test/src/create_jwt.dart
Outdated
Show resolved
Hide resolved
packages/google_sign_in/google_sign_in_web/example/integration_test/src/create_jwt.dart
Outdated
Show resolved
Hide resolved
ac078b0
to
efad291
Compare
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.
My review is pretty high level since I don't know the details of the SDK here, but overall it looks good!
packages/google_sign_in/google_sign_in_web/example/integration_test/src/create_jwt.dart
Outdated
Show resolved
Hide resolved
packages/google_sign_in/google_sign_in_web/example/integration_test/src/jsify_as.dart
Outdated
Show resolved
Hide resolved
packages/google_sign_in/google_sign_in_web/lib/google_sign_in_web.dart
Outdated
Show resolved
Hide resolved
packages/google_sign_in/google_sign_in_web/lib/src/gis_client.dart
Outdated
Show resolved
Hide resolved
packages/google_sign_in/google_sign_in_web/lib/src/gis_client.dart
Outdated
Show resolved
Hide resolved
d6fd4d8
to
95f3d9e
Compare
Hm... Maybe? I'll give this another shot tomorrow, it seems all that needs to be done is to base-64 decode (and JSON.parse) the middle bit of the token? :/ https://stackoverflow.com/questions/52017389/how-to-get-the-claims-from-a-jwt-in-my-flutter-application |
Rebasing to pick up the latest .ci.yaml changes from main. |
7fb3abf
to
382ed3d
Compare
I think I've addressed all your comments @stuartmorgan, PTAL! |
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 with one nit. Thanks for paring down the dependencies!
* cd09d9d31 [ci] Update iOS simulator (flutter/plugins#7131) * 016c3b7f1 Roll Flutter from df41e58 to 22e17bb (28 revisions) (flutter/plugins#7186) * 7160f55e8 [ios_platform_images] Update minimum version to iOS 11 (flutter/plugins#6874) * ea048a249 [in_app_purchase] Update minimum Flutter version to 3.3 and iOS 11 (flutter/plugins#6873) * 530442456 [google_sign_in_web] Migrate to the GIS SDK. (flutter/plugins#6921) * 9a3a77e6c [image_picker] Fix images changing to incorrect orientation (flutter/plugins#7187) * 8f3419be5 Roll Flutter from 22e17bb to 298d8c7 (20 revisions) (flutter/plugins#7190)
@ditman "User profiles retrieved in this way do NOT contain a proper idToken." Ok, I can see it on the migration guide, on this PR and almost everywhere. You are not populating idToken on signIn. But I was using this plugin only in order to retrieve that idToken, how should I achieve that now? All documentations written said idToken is null, but no one said how to retrieve it from now. I don't need user information, I just need an idtoken to send to my backend... Could you please explain how should I migrate? |
@sbatezat make sure that you use The lack of |
I've tried signInSilently, it returns null (as explained on the documentation) and show nothing to the end user. After signinSilently, I'm calling again signIn, and there is still no IdToken. If there is no IdToken, what should be the process to validate user server side? |
@sbatezat The user must be signed in to their browser for signInSilently to do its thing, and if the OneTap UX worked successfully, you'll have the
You can't validate users without an idToken server-side, so I guess that for the server-side validation of users, a larger change to your app is required until the Oauth popup starts returning idTokens. Look at the documentation, you may want to use the "Button" flow? |
This PR migrates
google_sign_in_web
to the Google Identity Services SDK, in a somewhat "backwards-compatible" way.There are big differences between the old and new authentication/authorization SDKs, so even though this is API compatible with the old client, there are subtle differences in the underlying behavior that prompted a major version update:
signInSilently
will trigger the One Tap user experience.requestScopes
orsignIn
is required to authorize the user).signInSilently
method has currently been made to always returnnull
(even on successful authentication) to prevent apps from triggering requests without being authorized.signIn
will trigger an oauth2 popup.signInSilently
:idToken
.signInSilently
:CredentialResponse
received from the One Tap flow.Version bump
This is a major reimplementation of the plugin, and there are some subtle differences in behavior (see above), so this probably warrants a new major version.
Tests
Issues
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.