skip to Main Content

All of a sudden I got this error while doing the login and registration process.

I came across it while trying to register on the signup screen.

2

Answers


  1. Chosen as BEST ANSWER

    I solved the problem in the firebase_auth.dart file:

    } catch (e) {
          gmrethrow;
        }
    

    I changed it like this:

     } catch (e) {
          rethrow;
        }
    

    and problem solved.


  2. You can handle like this way:

    @override
      Future<dynamic> loginWithEmailAndPassword(String email, String password) async {
        try {
          await _firebaseAuth.signInWithEmailAndPassword(
              email: email, password: password);
          return FirebaseSignInWithEmailResponse();
        } catch (exception) {
          return _mapLoginWithEmailError(exception);
        }
      }
    
      ApiError _mapLoginWithEmailError(PlatformException error) {
        final code = error.code;
        if (code == 'ERROR_INVALID_EMAIL') {
          return FirebaseSignInWithEmailError(
              message: 'Your email is not valid. Please enter a valid email',
              type: FirebaseSignInWithEmailErrorType.INVALID_EMAIL);
        } else if (code == 'ERROR_WRONG_PASSWORD') {
          return FirebaseSignInWithEmailError(
              message: 'Your password is incorrect',
              type: FirebaseSignInWithEmailErrorType.WRONG_PASSWORD);
        } else if (code == 'ERROR_USER_NOT_FOUND') {
          return FirebaseSignInWithEmailError(
              message: 'You do not have an account. Please Sign Up to'
                  'proceed',
              type: FirebaseSignInWithEmailErrorType.USER_NOT_FOUND);
        } else if (code == 'ERROR_TOO_MANY_REQUESTS') {
          return FirebaseSignInWithEmailError(
              message: 'Did you forget your credentials? Reset your password',
              type: FirebaseSignInWithEmailErrorType.TOO_MANY_REQUESTS);
        } else if (code == 'ERROR_USER_DISABLED') {
          return FirebaseSignInWithEmailError(
              message: 'Your account has been disabled. Please contact support',
              type: FirebaseSignInWithEmailErrorType.USER_DISABLED);
        } else if (code == 'ERROR_OPERATION_NOT_ALLOWED') {
          throw 'Email and Password accounts are disabled. Enable them in the '
              'firebase console?';
        } else {
          return FirebaseSignInWithEmailError(
              message: 'Make sure you have a stable connection and try again'
              type: FirebaseSignInWithEmailErrorType.CONNECTIVITY);
        }
      }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search