Closed tranb3r closed 1 year ago
Hmm, I'm getting FIRAuthError.WrongPassword
when I'm trying to sign in with an incorrect password, see screenshot:
Are you using an account that has only signed in via password so far or is it maybe linked to some other method as well?
I'll check again. But in Android/Auth/FirebaseAuthImplementation.cs, I don't see you setting WrongPassword in FIRAuthError.
private static CrossFirebaseAuthException GetFirebaseAuthException(Exception ex)
{
return ex switch {
FirebaseAuthEmailException => new CrossFirebaseAuthException(FIRAuthError.InvalidEmail, ex.Message),
FirebaseAuthInvalidUserException => new CrossFirebaseAuthException(FIRAuthError.UserNotFound, ex.Message),
FirebaseAuthWeakPasswordException => new CrossFirebaseAuthException(FIRAuthError.WeakPassword, ex.Message),
FirebaseAuthInvalidCredentialsException => new CrossFirebaseAuthException(FIRAuthError.InvalidCredential, ex.Message),
FirebaseAuthUserCollisionException { ErrorCode: "ERROR_EMAIL_ALREADY_IN_USE" } => new CrossFirebaseAuthException(FIRAuthError.EmailAlreadyInUse, ex.Message),
FirebaseAuthUserCollisionException { ErrorCode: "ERROR_ACCOUNT_EXISTS_WITH_DIFFERENT_CREDENTIAL" } => new CrossFirebaseAuthException(FIRAuthError.AccountExistsWithDifferentCredential, ex.Message),
_ => new CrossFirebaseAuthException(FIRAuthError.Undefined, ex.Message)
};
}
Ah yes, you are right, I've only tested it on iOS...I've added a new case to the switch statement: https://github.com/TobiasBuchholz/Plugin.Firebase/commit/527bec4d2bdfe07a4a595f3d15597c0d91662dde It will be shipped with the next version :)
When using firebase auth on android, the wrong error code is returned when the user enters an invalid password on sign-in. The FirebaseAuthException reason that is currently returned is FIRAuthError.InvalidCredential, while the message seems correct ("The password is invalid or the user does not have a password."). Could you please fix this and make sure the FIRAuthError returned is WrongPassword instead of InvalidCredential? Or maybe there is a reason why it's InvalidCredential instead of WrongPassword?