I am using google_sign_in_web 0.10.2 https://pub.dev/packages/google_sign_in_web and following the posted example
Here is some of the relevant code:
GoogleSignIn _googleSignIn = GoogleSignIn(
scopes: [
'email',
'https://www.googleapis.com/auth/contacts.readonly',
],
);
@override
void initState() {
super.initState();
_googleSignIn.onCurrentUserChanged.listen((GoogleSignInAccount? account) {
setState(() {
_currentUser = account;
});
if (_currentUser != null) {
_handleGetContact(_currentUser!);
}
});
_googleSignIn.signInSilently();
}
I can't find a way to set the access_type
to offline
.
Is this set by default by the library? Else how?
Thank you.
It looks like this is currently not possible: the source code of this library explicitly mentions it:
// On Android, there isn't an API for refreshing the idToken, so re-use
// the one we obtained on login.
response.idToken ??= _idToken;
There are also open issues and an open pull request which address this issue:
https://github.com/flutter/plugins/pull/3356 is a PR aiming to fix this
https://github.com/flutter/flutter/issues/45847 is an issue describing this problem.
https://github.com/flutter/flutter/issues/15796 another issue
But it is coming!
It looks like very recently (5 days ago) a new parameter forceCodeForRefreshToken
has been merged into the development version: https://github.com/flutter/plugins/pull/6130 and will be coming into 6.1.0 (not released yet).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.