flutter web using firebase gives internal-error

Viewed 67

I am trying to sign in using firebase on flutter web which already works on android but anytime I try it on the web I get the below logged error.

[log] internal-error =====> {"error":{"code":400,"messag…dentitytoolkit.googleapis.com"}}]}} =======> null

and my sign in code below

Future<Either<AuthFailure, Unit>> signInWithEmailAndPassword({
  required String emailAddress,
  required String password,
}) async {
  try {
    await _firebaseAuth.signInWithEmailAndPassword(
      email: emailAddress,
      password: password,
    );
    return right(unit);
  } on FirebaseAuthException catch (e) {
    if (e.code == 'ERROR_WRONG_PASSWORD' ||
        e.code == 'ERROR_USER_NOT_FOUND') {
      return left(const AuthFailure.invalidEmailAndPasswordCombination());
    } else {
      log('${e.code} =====> ${e.message} =======> ${e.stackTrace}');
      return left(const AuthFailure.serverError());
    }
  }
}
2 Answers

I checked that error that you mentioned was not written on the documents of Firebase auth, so I did some searches and tested three different scenarios.

  1. Red Square from the picture: That user is not on the Firebase
  2. Orange Square from the picture: I sent the empty Email and Password to the Firebase Auth.
  3. Green Square from the picture: it logged properly with that account that has registered on the Firebase Auth.

You could see when you initialized Firebase Auth, you will get nice information from the console. I think you might have some problems with the internet instead of FirebaseAuth.

Reference: Firebase Error Code

enter image description here

Related