-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
Is there an existing issue for this?
- I have searched the existing issues.
Which plugins are affected?
Auth
Which platforms are affected?
Android
Description
When using FirebaseAuth.instance.signInWithEmailAndPassword, the login is successful when the credentials are correct. However, if:
The email is incorrect (user-not-found)
Or the password is incorrect (wrong-password)
The exception is not handled correctly as documented.
According to the FlutterFire documentation:
https://firebase.flutter.dev/docs/auth/password-auth
and Firebase’s official guide:
https://github.com/firebase/flutterfire/blob/main/docs/auth/password-auth.md
We should be able to catch FirebaseAuthException like this:
try {
final credential = await FirebaseAuth.instance.signInWithEmailAndPassword(
email: emailAddress,
password: password,
);
} on FirebaseAuthException catch (e) {
if (e.code == 'user-not-found') {
print('No user found for that email.'); // it not trigger when email is not exist
} else if (e.code == 'wrong-password') {
print('Wrong password provided for that user.'); // it not trigger when user is correct but pass are incorrect
}
}
But in practice, neither 'user-not-found' nor 'wrong-password' messages are triggered. It seems the FirebaseAuthException is thrown, but something in the plugin or method causes the flow to exit before reaching the conditional error handling.
Reproducing the issue
Reproducing the issue
1.Use valid email with wrong password
- Use invalid email with any password
3.Observe that neither of the expected error messages is printed.
Bug Video
https://drive.google.com/file/d/1x-8iaQTkwx4pgndwygwL78bele00JvcT/view?usp=sharing
Firebase Core version
3.15.2
Flutter Version
3.29.2
Relevant Log Output
Flutter dependencies
No response
Additional context and comments
No response