我想让用户在注册后输入他们将收到的代码来验证他们的电子邮件。 (取代电子邮件验证) 将当前用户的对象属性“emailVerified”设置为 true 应该是什么方法?
if (userCodeInput === verificationCode) {
currentUser.updateProfile({
emailVerified: true,
displayName: "name changed"
}).then(function() {
// Update successful.
}).catch(function(error) {
// An error happened.
});
}
适用于 displayName,但不适用于 emailVerified。
最佳答案
这可能可以在 admin-sdk 中完成,但不能在客户端 sdk 上完成。
https://firebase.google.com/docs/auth/admin/manage-users#update_a_user
这是有道理的,因为用户不应该有权绕过验证流程,但管理员应该。
关于javascript - 如何设置当前用户电子邮件已验证: true in the browser (replace actual email verification)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50748389/