@@ -45,9 +45,52 @@ See more differences in the following migration guides:
45
45
46
46
### New use cases to take into account in your app
47
47
48
+ #### Enable access to the People API for your GCP project
49
+
50
+ Since the GIS SDK is separating Authentication from Authorization, the
51
+ [ Oauth Implicit pop-up flow] ( https://developers.google.com/identity/oauth2/web/guides/use-token-model )
52
+ used to Authorize scopes does ** not** return any Authentication information
53
+ anymore (user credential / ` idToken ` ).
54
+
55
+ If the plugin is not able to Authenticate an user from ` signInSilently ` (the
56
+ OneTap UX flow), it'll add extra ` scopes ` to those requested by the programmer
57
+ so it can perform a [ People API request] ( https://developers.google.com/people/api/rest/v1/people/get )
58
+ to retrieve basic profile information about the user that is signed-in.
59
+
60
+ The information retrieved from the People API is used to complete data for the
61
+ [ ` GoogleSignInAccount ` ] ( https://pub.dev/documentation/google_sign_in/latest/google_sign_in/GoogleSignInAccount-class.html )
62
+ object that is returned after ` signIn ` completes successfully.
63
+
64
+ #### ` signInSilently ` always returns ` null `
65
+
66
+ Previous versions of this plugin were able to return a ` GoogleSignInAccount `
67
+ object that was fully populated (signed-in and authorized) from ` signInSilently `
68
+ because the former SDK equated "is authenticated" and "is authorized".
69
+
70
+ With the GIS SDK, ` signInSilently ` only deals with user Authentication, so users
71
+ retrieved "silently" will only contain an ` idToken ` , but not an ` accessToken ` .
72
+
73
+ Only after ` signIn ` or ` requestScopes ` , a user will be fully formed.
74
+
75
+ The GIS-backed plugin always returns ` null ` from ` signInSilently ` , to force apps
76
+ that expect the former logic to perform a full ` signIn ` , which will result in a
77
+ fully Authenticated and Authorized user, and making this migration easier.
78
+
79
+ #### ` idToken ` is ` null ` in the ` GoogleSignInAccount ` object after ` signIn `
80
+
81
+ Since the GIS SDK is separating Authentication and Authorization, when a user
82
+ fails to Authenticate through ` signInSilently ` and the plugin performs the
83
+ fallback request to the People API described above,
84
+ the returned ` GoogleSignInUserData ` object will contain basic profile information
85
+ (name, email, photo, ID), but its ` idToken ` will be ` null ` .
86
+
87
+ This is because JWT are cryptographically signed by Google Identity Services, and
88
+ this plugin won't spoof that signature when it retrieves the information from a
89
+ simple REST request.
90
+
48
91
#### User Sessions
49
92
50
- Since the new SDK does * not * manage user sessions anymore, apps that relied on
93
+ Since the new SDK does _ not _ manage user sessions anymore, apps that relied on
51
94
this feature might break.
52
95
53
96
If long-lived sessions are required, consider using some User authentication
@@ -58,7 +101,7 @@ Flutter web).
58
101
59
102
#### Expired / Invalid Authorization Tokens
60
103
61
- Since the new SDK does * not * auto-renew authorization tokens anymore, it's now
104
+ Since the new SDK does _ not _ auto-renew authorization tokens anymore, it's now
62
105
the responsibility of your app to do so.
63
106
64
107
Apps now need to monitor the status code of their REST API requests for response
@@ -67,21 +110,10 @@ codes different to `200`. For example:
67
110
* ` 401 ` : Missing or invalid access token.
68
111
* ` 403 ` : Expired access token.
69
112
70
- In either case, your app needs to prompt the end user to ` signIn ` again, to
71
- interactively renew the token. The GIS SDK limits authorization token duration
72
- to one hour (3600 seconds).
73
-
74
- #### Null ` idToken `
75
-
76
- The ` GoogleSignInUserData ` returned after ` signIn ` may contain a ` null ` ` idToken `
77
- field. This is not an indication of the session being invalid, it's just that
78
- the user canceled (or wasn't presented with) the OneTap UX from ` signInSilently ` .
79
-
80
- In cases where the OneTap UX does not authenticate the user, the ` signIn ` method
81
- will attempt to "fill in the gap" by requesting basic profile information of the
82
- currently signed-in user.
113
+ In either case, your app needs to prompt the end user to ` signIn ` or
114
+ ` requestScopes ` , to interactively renew the token.
83
115
84
- In that case, the ` GoogleSignInUserData ` will contain a ` null ` ` idToken ` .
116
+ The GIS SDK limits authorization token duration to one hour (3600 seconds) .
85
117
86
118
## Usage
87
119
0 commit comments