我需要获取最新的用户数据,例如 - emailVerified
、displayName
和 profilePhoto
。用户已经登录。我想要某种事件,或者可能是调用服务器以查看用户配置文件数据的最新值。
firebase.auth().currentUser.emailVerified
我正在尝试这个,但它从本地返回值(登录时缓存的值),而不是来自服务器的最新值。 一个问题已经存在,但没有回答。 :(
how to get the latest firebase user authentication data from server?
答案 0 :(得分:0)
您需要调用 reload()
方法,该方法是异步的并返回一个 Promise。
firebase.auth().currentUser.reload()
.then(() => {
if (firebase.auth().currentUser.emailVerified) {
//...
} else {
//...
}
});