skip to Main Content

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


  1. There might be many issues with showing that error.

    1. Make sure that the password length must be six or more
    2. Verify that your Firebase project’s authentication settings are correctly configured.
    3. Add SHA1 and SHA256 to your Firebase project
    4. Confirm that your app is correctly configured to use your Firebase project. Check your google-services.json (for Android) or GoogleService-Info.plist (for iOS) configuration files and update them with the previous one.
    5. Sometimes, network issues can cause authentication failures. Ensure that your device has a stable internet connection when signing in.
    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search