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
You can create your own implementation of the google_sign_in class. In the end it's just an OAuth token. Here's a web implementation of a custom google_sign_in service: https://stackoverflow.com/a/69746036/5492496
I'm pretty sure you can do the same for Android & iOS using web view.
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');
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.