i am trying to sign in with google first my info i chose google account it stuck in loading without any response or even any console message realted to it here is my code
GoogleSignInAccount _currentUser;
GoogleSignIn _googleSignIn = GoogleSignIn(
scopes: [
'email',
'https://www.googleapis.com/auth/cloud-platform.read-only',
],
);
@override
void initState() {
super.initState();
_googleSignIn.onCurrentUserChanged.listen((GoogleSignInAccount account) {
setState(() {
_currentUser = account;
});
});
_googleSignIn.signInSilently();
}
Future<void> _googlelogin() async {
try {
final GoogleSignInAccount googleSignInAccount =
await _googleSignIn.signIn();
final GoogleSignInAuthentication googleSignInAuthentication =
await googleSignInAccount.authentication;
} catch (error) {
print(error);
}
}
....
RaisedButton(
onPressed: () {
_googlelogin();
},),
),
preview of what happening
preview of messages in console if it related
Make sure that you are requesting only information of the scopes you are allowed to access.
In my case, I copied the following example and didn't notice that I don't have access to contacts.
GoogleSignIn _googleSignIn = GoogleSignIn(
scopes: [
'email',
'https://www.googleapis.com/auth/contacts.readonly',
],
);
Changing to the following worked for me.
GoogleSignIn _googleSignIn = GoogleSignIn(
scopes: [
'email',
],
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With