0
votes

Is there a way to get the access token and refresh token from google sign in with flutter? I'm using: google_sign_in: ^3.0.4

1

1 Answers

-2
votes

You can try getting it this way:

 GoogleSignIn _googleSignIn = new GoogleSignIn(
    scopes: <String>[ 
      'profile',
      'email',
      'https://www.googleapis.com/auth/contacts.readonly',
    ],
  );

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