-
Notifications
You must be signed in to change notification settings - Fork 28.5k
[google_sign_in] iOS incremental auth - Can't switch account and already granted scopes are not included #86660
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
Comments
@remidenele Thank you for the detailed report. We'll test this flow when we adopt 6.0. #86436 |
@remidenele great job, reporting here! I got exactly the same situation. |
@LiveLikeCounter Unfortunately no... My current implementation on iOS is to:
That's far from ideal but I don't have a better solution for now. I've also concerns because it appears that the 6.0 release of GoogleSignIn iOS doesn't allow scopes to be requested at the same time as sign in, as noted by @jmagman. |
I have a similar issue to this, specifically login with a different account with different scopes. My app has 2 login features:
On Android it work perfectly, while in IOS, if I login using a Google account then connect to youtube using the same account or a different account with different scopes, the first time it throw Request had insufficient authentication scopes error, after that I can connect to Youtube account normally. This only happen in IOS the first time connect to Youtube after login. |
Hi When is this issue expected to be fixed? According to the following quote, this should be a relatively simple fix.
Also, is there a way to fetch all the authorized scopes from GoogleOauth2Api.tokenInfo.scope when any google user signs in, regardless of what scopes were used in GoogleSignIn during the sign in process? GoogleSignIn.scopes I'd appreciate any help I can get. 😇 |
@remidenele I tested on flutter/plugins#5708 and I now see the app switcher.
Also tested on flutter/plugins#5708, the previously granted scopes are granted again.
@lightspect I suspect your case will also be fixed by flutter/plugins#5708. |
Would appreciate test coverage of flutter/plugins#5708. You can get it explicitly by adding |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
PR#2599 introduced the ability to request additional scopes after sign-in (incremental auth), allowing to request access to sensitive data only when needed and in the context where it makes sense to the user (cf. Requesting additional scopes on Android / on iOS).
While it works perfectly on Android, it is not really usable on iOS for 2 reasons:
You can't switch to another Google account without closing / reopening your app
After granting additional scopes using the
requestScopes()
method for Account A, you can't sign out to switch to Account B without closing / reopening your app. Indeed if you callsignOut()
and thensignIn()
to select Account B, the account chooser is not displayed and Account A is automatically selected and used.It seems to be related to the way the additional permission request is implemented on iOS: it sets the
loginHint
of theGIDSignIn sharedInstance
with the current user email before callingsignIn()
. But then, when callingsignOut()
theloginHint
(and thescopes
) of thesharedInstance
are not cleared, so they are reused next timesignIn()
is called.The current
requestScopes()
method implementation corresponds to what was described in the the Google Identity documentation:But the documentation was updated on July 13, advising to use the
addScopes
method instead:The
addScopes
methods was introduced in the recent 6.0 release of GoogleSignIn iOS for which an issue (#86436) was opened a few days ago, to update the dependency. I don't know if this method will fix the issue but I hope so, at least it doesn't seem to modify a "shared instance" to do the additional permissions request.Already granted scopes are not included at next sign in
GoogleSignIn()
with minimal scopes, e.g.GoogleSignIn(scopes: ['email', 'profile']);
requestScopes(['https://www.googleapis.com/auth/drive.file'])
,signOut()
,GoogleSignIn()
with minimal scopessignIn()
and select your accountYou obtain an access token with only the
email
andprofile
scopes, so only the scopes declared when instantiating theGoogleSignIn()
are requested. Already granted scopes are not included and there is no option to include them (like when using the include_granted_scopes option when doing Web sign-in), whereas on Android already granted scopes are included when you sign in back.The text was updated successfully, but these errors were encountered: