I am using Ionic2/Angular2 with AngularFire2 and Firebase to authenticate my users at login.
After I register a user via email & password successfully, I can login with that email & password successfully.
public fireAuth: firebase.auth.Auth;
...
loginFirebaseUser(email: string, password: string): firebase.Promise<boolean> {
return this.fireAuth.signInWithEmailAndPassword(email, password).then(() => {
console.log('signInWithEmailAndPassword', email, password);
}).catch((error)=> {
console.error('Error signInWithEmailAndPassword', email, password, error.name, error.message);
throw new Error(error.message);
});
}
When I change the users email, it updates successfully (I can see the update in the admin console and there's no errors).
this.fireAuth.onAuthStateChanged((firebaseUser: firebase.User) => {
firebaseUser.updateEmail(newEmail).then((data) => {...
I then verify the new email successfully. However, when I try login in again with the new email and password, I get:
There is no user record corresponding to this identifier. The user may have been deleted.
In summary, if I don't update the email address, everything works. If I do update the email address, I get the above error if I try log in.
When a user updates their email, password or resets their password. Firebase Auth backend revokes their tokens requiring that they reauthenticate or try to sign in again. This is a security feature. For example a user may reset their password if their account was compromised. All other sessions must reauthenticate.
This is happening because the email with you are login/sign-in with does not exist, either you have to register that email it with auth.createUserWithEmailAndPassword then login/sign-up or correct your email and password.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With