Firebase:没有与此标识符对应的用户记录。用户可能已被删除

Ric*_*ard 5 firebase firebase-authentication ionic2 angularfire2 angular

我在将Ionic2 / Angular2与AngularFire2和Firebase结合使用时在登录时对我的用户进行身份验证。

通过电子邮件和密码成功注册用户后,可以成功使用该电子邮件和密码登录。

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);
        });
    }
Run Code Online (Sandbox Code Playgroud)

更改用户电子邮件后,它会成功更新(我可以在管理控制台中看到更新,并且没有错误)。

this.fireAuth.onAuthStateChanged((firebaseUser: firebase.User) => {
    firebaseUser.updateEmail(newEmail).then((data) => {...
Run Code Online (Sandbox Code Playgroud)

然后,我成功验证了新电子邮件。但是,当我尝试使用新的电子邮件和密码再次登录时,我得到:

There is no user record corresponding to this identifier. The user may 
 have been deleted.
Run Code Online (Sandbox Code Playgroud)

总之,如果我不更新电子邮件地址,则一切正常。如果我确实更新了电子邮件地址,则尝试登录时会出现上述错误。

boj*_*eil 4

当用户更新其电子邮件、密码或重置密码时。Firebase Auth 后端会撤销他们的令牌,要求他们重新进行身份验证或尝试再次登录。这是一项安全功能。例如,如果用户的帐户遭到泄露,用户可以重置其密码。所有其他会话都必须重新进行身份验证。