How to get additional scopes from GoogleSignIn in Flutter?
1,711
I hope this answer will help you. You can try adding a scope in your GoogleSignIn() method like that
GoogleSignIn _googleSignIn = GoogleSignIn(
scopes: [
'email',
'https://www.googleapis.com/auth/contacts.readonly',
],
);
And you can adjust your scopes based on the information you want to access. And this is the link to the full list of scopes you can use Google Scopes list
Note that some scopes will require app verification and it's mentioned in the above link.
Comments
-
Arnav over 1 year
I have a method which I am using to get a users basic info like birthday, gender & phone number and I'm now sure how to implement it in Flutter?
void signInWithGoogle(context) async { final GoogleSignIn _googleSignIn = GoogleSignIn(); try { final GoogleSignInAccount googleUser = await _googleSignIn.signIn(); final GoogleSignInAuthentication googleAuth = await googleUser.authentication; final AuthCredential credential = GoogleAuthProvider.credential( accessToken: googleAuth.accessToken, idToken: googleAuth.idToken, ); final User user = (await _auth.signInWithCredential(credential)).user; } catch (error) { print('Google error: $error'); } }
-
Terry Torres about 3 yearsOkay. And then what? Which API is accessed to get this information, and how?