Did anyone manage to get the id token from google sign in (Flutter)

房东的猫 提交于 2020-06-11 17:14:07

问题


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

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: Not using firebase , only google sign in.

Can anyone guide me how to get the id Token ?


回答1:


You can try using this

 _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');
      });


来源:https://stackoverflow.com/questions/52458968/did-anyone-manage-to-get-the-id-token-from-google-sign-in-flutter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!