I get this error when signing in with google utilizing firebase in flutter. There’s one other comparable query – already tried all solutions none labored
Issues I’ve accomplished
-
Added a help e-mail
-
Generated a sha1 and sha256 utilizing the command
keytool -list -v -keystore <keystore path>
-
Configured Oauth display screen in google cloud – so added a help e-mail there too and set e-mail customers to exterior
-
Utilizing my precise telephone as an emulator, so it does have google play put in
Pictures & Code
Code (shortened):
ultimate GoogleSignIn googleSignIn = GoogleSignIn();
ultimate GoogleSignInAccount? googleSignInAccount =
await googleSignIn.signIn().catchError(
(onError) => throw(onError)
);
if (googleSignInAccount != null) {
ultimate GoogleSignInAuthentication googleSignInAuthentication =
await googleSignInAccount.authentication;
ultimate AuthCredential credential = GoogleAuthProvider.credential(
accessToken: googleSignInAuthentication.accessToken,
idToken: googleSignInAuthentication.idToken,
);
strive {
ultimate UserCredential userCredential =
await _auth.signInWithCredential(credential);
} on FirebaseAuthException catch (e) {
if (e.code == 'account-exists-with-different-credential') {
print('The account already exists with a distinct credential.');
} else if (e.code == 'invalid-credential') {
print('Error occurred whereas accessing credentials. Attempt once more.');
}
} catch (e) {
print(e);
}