是否有人设法从Google登录中获取ID令牌(Flutter) [英] Did anyone manage to get the id token from google sign in (Flutter)
本文介绍了是否有人设法从Google登录中获取ID令牌(Flutter)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将我的用户连接到我的后端服务器,我使用了来自google官方登录插件的例子:
https://pub.dartlang.org/packages/google_sign_in
I am trying to connect my users with my back end server , i used the example from the official google sign in plugin for flutter : https://pub.dartlang.org/packages/google_sign_in
签名过程很好,我得到了用户名和电子邮件等。
,但我需要ID令牌才能通过我的服务器对用户进行身份验证。
the sign process goes fine and i get the username and email ect.. but i need the id Token to authenticate the user with my server.
Ps:不使用firebase,仅使用google登录。
Ps: Not using firebase , only google sign in.
有人可以指导我如何获取ID令牌吗?
Can anyone guide me how to get the id Token ?
推荐答案
您可以尝试使用此
_googleSignIn.signIn().then((result){
result.authentication.then((googleKey){
print(googleKey.accessToken);
print(googleKey.idToken);
print(_googleSignIn.currentUser.displayName);
}).catchError((err){
print('inner error');
});
}).catchError((err){
print('error occured');
});
这篇关于是否有人设法从Google登录中获取ID令牌(Flutter)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文