Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting an error while signin in flutter firebase

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

like image 544
Neal Avatar asked Sep 06 '25 08:09

Neal


1 Answers

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.

like image 159
Patch Thomas Avatar answered Sep 08 '25 12:09

Patch Thomas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!