执行这段代码:
firebase.auth().signOut();
尽管用户注销,
user.getIdToken
生成新的 token 。用户不为空。firebase.auth().onAuthStateChanged(function(user) {
if (user) {
user.getIdToken(true).then((token) => console.log(token)).catch((err) => { console.log(err)});
} else {
}
});
最佳答案
firebase.auth().signOut() 在 Android 和 iOS 中注销用户。我测试了它。之后 CurrentUser 应该为 null(在 iOS 中为 nil)。如果没有,您的其他代码可能会导致应用程序或事件崩溃,从而阻止该过程完成 - 这就是我的遭遇。
不需要 onAuthStateChanged。
关于javascript - 我无法从 firebase 注销,仍然用户不为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48399142/