-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[google_sign_in] Add new Oauth scope methods to google_sign_in_platform_interface. #2547
[google_sign_in] Add new Oauth scope methods to google_sign_in_platform_interface. #2547
Conversation
|
Re-created PR since I messed up a rebase. Sorry about that. |
|
@ditman This is an internal request. I am not sure how to review it since I am used to reviewing end to end implementations of plugin code. This is just a change on interface. Could you please advise? |
|
@mehmetf This looks good, the only thing "missing" (which I'm assuming is on a separate PR for the My only comment may be that this methods seem to be called (This also seems implementable on web through the hasGrantedScopes and grant methods?) |
|
@emerssso re: naming: whatever makes more sense when using the plugin is fine, no need to rename. Re: splitting the PR: yes, it is needed to publish the packages in the correct order. Thanks for the link! |
|
Suggested offline that this would be improved by allowing multiple new scopes to be requested at once so the user doesn't potentially have to be prompted multiple times in that case. I'll work on that and add the changes needed to each PR. |
|
Updated both methods to allow the caller to pass multiple scopes. The flow I'm envisioning is Still working on updating the implementations; wanted to get feedback on this change to the API. |
.../google_sign_in/google_sign_in_platform_interface/lib/src/method_channel_google_sign_in.dart
Outdated
Show resolved
Hide resolved
@emerssso Can we do the "missingScopes" check internally, so the user doesn't have to care about the ones that are already granted? I think that'd make the API slightly easier to use. |
That would meet my immediate needs. I've seen uses of the "missingScopes" flow, but it's not necessary. |
|
@emerssso just trying to keep the API surface of the plugin as small as possible (and as close as possible to the Google Sign In API itself; the closest thing I've seen there is |
|
@ditman Makes sense. I'll consolidate them to just |
|
This makes sense to me, but please seek approval from @cyanglaz since this affects all platforms, not only web! (PS: Thanks for the web implementation!) |
| } | ||
|
|
||
| /// Requests the user grants additional Oauth [scopes]. | ||
| Future<bool> requestScopes(List<String> scopes) async { |
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.
what can be the values of the scopes? Maybe we should either make an enum or have some concrete list of what the values can be.
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.
@cyanglaz There's a TON of auth scopes, here's the list: https://developers.google.com/identity/protocols/googlescopes (each API that you want to use has its own set of scopes). In Java for example, each API may provide its set of scopes, and not the core plugin.
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.
Maybe we can add this link to the dartdoc?
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.
Yes, that's a good point! It can probably be added to the README.md.
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.
Added a link in the dartdoc. Looks like this is already mentioned in the README.md here.
cyanglaz
left a comment
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
Description
Adds two new methods,
hasGrantedScopeandrequestScope, to theGoogleSginInPlatformclass and the method channel implementation.I have a second branch queued up for the implementations, but my understanding of the federated plugin design is that this has to be merged and pushed to pub first?
Related Issues
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?