While doing signin with a wrong email or password i was expecting to get the snackbar i had entered but instead i am getting an error in my console.
error –
Initial task failed for action
RecaptchaAction(action=signInWithPassword)with exception – An internal
error has occurred. [ INVALID_LOGIN_CREDENTIALS].
Authservice code –
Future<UserCredential> signInUser(String email, String password) async {
UserCredential userCredential = await _auth.signInWithEmailAndPassword(
email: email,
password: password,
);
return userCredential;
}
Login Code –
Future<void> signIn() async {
try {
if (emailController.text.trim().isEmpty) {
return showWarningSnackBar(context, 'Empty Email');
}
if (passwordController.text.trim().isEmpty) {
return showWarningSnackBar(context, 'Empty Password');
}
await AuthService().signInUser(
emailController.text.trim(),
passwordController.text.trim(),
);
if (!context.mounted) return;
showSnackBar(context, 'Successfully logged in');
} on FirebaseAuthException catch (e) {
if (e.code == 'user-not-found') {
showErrorSnackBar(context, 'No user found for that email.');
} else if (e.code == 'wrong-password') {
showErrorSnackBar(context, 'Wrong password provided for that user.');
} else if (e.code == 'INVALID_LOGIN_CREDENTIALS') {
showErrorSnackBar(context, 'Login credentials are invalid.');
} else if (e.code == 'invalid-email') {
showErrorSnackBar(context, 'The email address is badly formatted.');
}
}
}
I have not tried anything
2
Answers
There might be many issues with showing that error.
SHA1
andSHA256
to your Firebase projectgoogle-services.json
(for Android) orGoogleService-Info.plist
(for iOS) configuration files and update them with the previous one.After facing a similar problem, I think this issue might because ’email enumeration protection’ is enabled.
‘Email enumeration is a type of brute-force attack in which a malicious actor attempts to guess or confirm users in a system by passing an email address to the API and checking the response.’
https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection
The link details how to disable it.
Hope this helps.