-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[google_sign_in] Add serverAuthCode attribute to google_sign_in_platform_interface #2634
Conversation
this.idToken, | ||
this.serverAuthCode, |
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.
I don't think the User should have information about the serverAuthCode.
Why not limit this to the GoogleSignInTokenData so it can only be retrieved by the getTokens()
call?
How do you want people to use this extension to the API? Can you write a quick example/documentation on how to use the new serverAuthCode
attribute?
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.
Thank you for review.
The serverAuthCode is intended to be used on iOS/Android and may also be used on Flutter for web. However, I haven't done any development on the web yet, so I haven't found any use cases on the web.
serverAuthCode usage is as follows.
Behavior of the existing API is the same. However, in order to be able to obtain the serverAuthCode, it is necessary to define the serverClientId on the native code side. here
It is expected that the serverAuthCode can be retrieved with GoogleSignInToken, it is the return value of the authentication
function in the GoogleSignInAccount class.
If the serverClientId was not defined, I expect the return value to be "null" when I access the attribute, because getting the serverAuthCode is optional.
In the Flutter App that I am developing, I am using the following
GoogleSignIn _googleSignIn = GoogleSignIn(scopes: <String>['email', etc...])
final account = await _googleSignIn.signIn();
final authentication = await account.authentication;
final serverAuthCode = authentication.serverAuthCode;
// follow serverAuthCode is used in private web service
Is this a reference?
With this latest change, you'd need to do:
Correct? |
Yes, that's what I want to do. In this PR, I will first change the interface. after that, by merging pr, can get the serverAuthCode. test will fail, so we change the interface first. |
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, this needs to be merged and published to pub.dev
, and then in your other PR, you need to update the pubspec.yaml of the google_sign_in package to depend in this version of google_sign_in_platform_interface (and fix whatever breaks there)
Let's get eyes from @cyanglaz here as well!
Please review. @cyanglaz |
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!
Please review. @mehmetf |
I'll merge this as soon as the tree goes green. Thanks for the patience @yamarkz! |
Done. I'll update this PR when I publish the package to pub.dev. |
…utter#2634) This change adds the `serverAuthCode` attribute to the `GoogleSignInTokenData` class. Usage: ``` // Sign in somewhere, then... final tokens = await _googleSignIn.getTokens(); final serverAuthCode = tokens.serverAuthCode; // serverAuthCode may be used by your server ```
…utter#2634) This change adds the `serverAuthCode` attribute to the `GoogleSignInTokenData` class. Usage: ``` // Sign in somewhere, then... final tokens = await _googleSignIn.getTokens(); final serverAuthCode = tokens.serverAuthCode; // serverAuthCode may be used by your server ```
…utter#2634) This change adds the `serverAuthCode` attribute to the `GoogleSignInTokenData` class. Usage: ``` // Sign in somewhere, then... final tokens = await _googleSignIn.getTokens(); final serverAuthCode = tokens.serverAuthCode; // serverAuthCode may be used by your server ```
Description
Add attribute
serverAuthCode
to, theGoogleSignInTokenData
class.serverAuthCode is used in this pr.
Related Issues
#2116
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?