Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase: There is no user record corresponding to this identifier. The user may have been deleted

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.

like image 270
Richard Avatar asked Jan 31 '17 08:01

Richard


2 Answers

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.

like image 189
bojeil Avatar answered Oct 16 '22 19:10

bojeil


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.

like image 40
akash maurya Avatar answered Oct 16 '22 19:10

akash maurya