This is my pubspec.yaml. I'm using Flutter:
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
shared_preferences: ^0.4.2
json_serializable: ^1.2.1
camera: ^0.2.3
path_provider: ^0.4.1
simple_permissions: ^0.1.6
share: ^0.5.3
#Google Sign_In
firebase_auth: ^0.5.20
google_sign_in: ^3.0.5
I cannot authenticate with the Google Sign In method. The window shows up normally and after my app throws a error:
PlatformException(sign_in_failed, Status{statusCode=CANCELED, resolution=null}, null)
Haven't found any solutions online, can someone help me out?
The following is my _signIn() method
Future<FirebaseUser> _signIn() async {
GoogleSignInAccount googleSignInAccount = await googleSignIn.signIn();
GoogleSignInAuthentication gSA = await googleSignInAccount.authentication;
FirebaseUser user = await auth.signInWithGoogle(
idToken: gSA.idToken, accessToken: gSA.accessToken);
print("User Name : ${user.displayName}");
return user;
}
My code crashes after I call GoogleSignInAccount googleSignInAccount = await googleSignIn.signIn(); so my guess was, that my setup was wrong.
This is how I call the _signIn()
MaterialButton(
child: Text("Google Sign-In"),
onPressed: (){
_signIn()
.then((FirebaseUser user) => print(user))
.catchError((e) => print(e));
},
),
I already deleted the Firebase-Project on the google dev console online and created a new one. Also I tried the anonymous login -> worked fine
Any help is appreciated