如何获得刷新令牌和expires从flutter谷歌登录插件中获取条件



我正试图在我的flutter应用程序中实现谷歌登录,但我缺少一些信息:-刷新令牌-过期秒。

你是如何获得这些信息的?

GoogleSignIn _googlSignIn = new GoogleSignIn(scopes: [
'https://www.googleapis.com/auth/userinfo.profile',
'https://www.googleapis.com/auth/userinfo.email',
'https://www.googleapis.com/auth/youtube',
]);
print('Google user ==>');
final GoogleSignInAccount googleUser = await _googlSignIn.signIn();
print(googleUser.id); //account_uid
print(googleUser.email);
print(googleUser.authHeaders);
print(googleUser.displayName); //display_name
print(googleUser.photoUrl); //image_url
print('Google Auth ==>');
final GoogleSignInAuthentication googleAuth = await googleUser.authentication;
print(googleAuth.accessToken);
print(googleAuth.hashCode);
print(googleAuth.idToken);

我还需要指定以下项目,

include_grandted_scopes:trueaccess_type:离线

生成刷新令牌尚不受google_sign_in插件的支持。此问题线程中发布了一个解决方法。刷新令牌可以通过向Identity Platform API发送请求来手动生成。

最新更新