-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[google_sign_in] Add server auth code retrieval to gis_client #5358
[google_sign_in] Add server auth code retrieval to gis_client #5358
Conversation
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie or stuartmorgan on the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
Thanks for solving the conflicts with the latest |
We'll need 2 reviewers, since this is @T-P-F's first contribution. Pinging @stuartmorgan for when he has a minute! |
@ditman thanks for the additions to the PR 🙏 |
FYI this is true for all PRs from contributors who are not Flutter team members (i.e., people with commit access), regardless of whether it's the first PR. (I'll add this to my review queue.) |
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 on my end!
(We could add a small section to the README on how to use the web_only
library maybe? I'm planning on updating the example app regardless.)
@ditman @stuartmorgan what's a realistic timeline for finishing review of this PR? |
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
Great fix @T-P-F !! 👏👏👏 |
Yay! I need to update the example to use the new user-facing web-only API! |
flutter/packages@bc72d15...5d9874f 2023-12-02 engine-flutter-autoroll@skia.org Roll Flutter from 918e336 to d861ce4 (29 revisions) (flutter/packages#5542) 2023-12-02 ditman@gmail.com [gsi_web] Do not initialize CodeClient if scopes are empty. (flutter/packages#5537) 2023-12-01 15619084+vashworth@users.noreply.github.com Reenable macOS 13 tests (flutter/packages#5494) 2023-12-01 mikemcguiness@protonmail.com [flutter_image] Adopt code excerpts in README (flutter/packages#5498) 2023-11-30 kevmoo@users.noreply.github.com [cross_file] Migrate to pkg:web, bump min SDK to Dart 3.2 (flutter/packages#5520) 2023-11-30 stuartmorgan@google.com [google_maps_flutter] Add support for version 8 of the iOS SDK (flutter/packages#5528) 2023-11-30 stuartmorgan@google.com [pointer_interceptor] Re-land: Add platform interface (flutter/packages#5525) 2023-11-30 61667947+T-P-F@users.noreply.github.com [google_sign_in] Add server auth code retrieval to gis_client (flutter/packages#5358) 2023-11-30 engine-flutter-autoroll@skia.org Roll Flutter from 5e5b529 to 918e336 (14 revisions) (flutter/packages#5526) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…r#5358) Adds the ability for a Flutter web app to request a server auth code via gis through a web-only method. Reference docs: * https://developers.google.com/identity/oauth2/web/guides/use-code-model * https://developers.google.com/identity/oauth2/web/reference/js-reference#google.accounts.oauth2.initCodeClient Also: adds a `web_only.dart` library that allows programmers to call web-only methods conveniently, without having to dive into the `Platform.instance` (which has a ton of methods that we don't want users to call for sure!), like this: ```dart import 'package:google_sign_in_web/web_only.dart' as web; /// Renders a web-only Sign-In button. Widget buildSignInButton({HandleSignInFn? _}) { return web.renderButton(); } ``` Instead of: https://github.com/flutter/packages/blob/a6821898bd5a968f8ddafa8ae8e9a8c889caa00a/packages/google_sign_in/google_sign_in/example/lib/src/sign_in_button/web.dart#L12-L15 ### Issues * Fixes flutter/flutter#62474 ### Tests * Added tests to ensure plugin calls hit the GIS API when appropriate. * [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. * [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. * [x] I read and followed the [relevant style guides] and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.) * [x] I signed the [CLA]. * [x] The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences] * [x] I listed at least one issue that this PR fixes in the description above. * [x] I updated pubspec.yaml with an appropriate new version according to the [pub versioning philosophy], or this PR is [exempt from version changes]. * [x] I updated CHANGELOG.md to add a description of the change, [following repository CHANGELOG style]. * [x] I updated/added relevant documentation (doc comments with ///). * [x] I added new tests to check the change I am making, or this PR is [test-exempt]. * [x] All existing and new tests are passing.
Looks like there's no way (AFAIK) to modify the scopes for serverAuthCode retrieval (to allow incremental authorization)? Once the scopes are set in Is incremental authorization possible at this moment? Would the preferred approach be to accept an optional list of scopes in Use case:
Happy to split this out into a bug report; just not sure if I'm missing something here. |
Whoops, just found this: flutter/flutter#139406 |
…r#5358) Adds the ability for a Flutter web app to request a server auth code via gis through a web-only method. Reference docs: * https://developers.google.com/identity/oauth2/web/guides/use-code-model * https://developers.google.com/identity/oauth2/web/reference/js-reference#google.accounts.oauth2.initCodeClient Also: adds a `web_only.dart` library that allows programmers to call web-only methods conveniently, without having to dive into the `Platform.instance` (which has a ton of methods that we don't want users to call for sure!), like this: ```dart import 'package:google_sign_in_web/web_only.dart' as web; /// Renders a web-only Sign-In button. Widget buildSignInButton({HandleSignInFn? _}) { return web.renderButton(); } ``` Instead of: https://github.com/flutter/packages/blob/a6821898bd5a968f8ddafa8ae8e9a8c889caa00a/packages/google_sign_in/google_sign_in/example/lib/src/sign_in_button/web.dart#L12-L15 ### Issues * Fixes flutter/flutter#62474 ### Tests * Added tests to ensure plugin calls hit the GIS API when appropriate. * [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. * [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. * [x] I read and followed the [relevant style guides] and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.) * [x] I signed the [CLA]. * [x] The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences] * [x] I listed at least one issue that this PR fixes in the description above. * [x] I updated pubspec.yaml with an appropriate new version according to the [pub versioning philosophy], or this PR is [exempt from version changes]. * [x] I updated CHANGELOG.md to add a description of the change, [following repository CHANGELOG style]. * [x] I updated/added relevant documentation (doc comments with ///). * [x] I added new tests to check the change I am making, or this PR is [test-exempt]. * [x] All existing and new tests are passing.
Adds the ability for a Flutter web app to request a server auth code via gis through a web-only method.
Reference docs:
Also: adds a
web_only.dart
library that allows programmers to call web-only methods conveniently, without having to dive into thePlatform.instance
(which has a ton of methods that we don't want users to call for sure!), like this:Instead of:
packages/packages/google_sign_in/google_sign_in/example/lib/src/sign_in_button/web.dart
Lines 12 to 15 in a682189
Issues
Tests
Pre-launch Checklist