[英]Google sign in for flutter web - Request offline access
我正在使用 google_sign_in_web 0.10.2 https://pub.dev/packages/google_sign_in_web並遵循發布的示例
以下是一些相關代碼:
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();
}
我找不到將access_type
設置為offline
的方法。
這是圖書館默認設置的嗎? 不然怎么辦?
謝謝你。
看起來這目前是不可能的:這個庫的源代碼明確提到了它:
// On Android, there isn't an API for refreshing the idToken, so re-use
// the one we obtained on login.
response.idToken ??= _idToken;
還有一些未解決的問題和解決此問題的公開拉取請求:
https://github.com/flutter/plugins/pull/3356是一個旨在解決此問題的 PR
但它來了!
看起來最近(5天前)一個新參數forceCodeForRefreshToken
已合並到開發版本中: https://github.com/flutter/plugins/pull/6130並將進入 6.1.0(尚未發布) .
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.