javascript - 如何设置当前用户电子邮件已验证: true in the browser (replace actual email verification)?

标签 javascript firebase

我想让用户在注册后输入他们将收到的代码来验证他们的电子邮件。 (取代电子邮件验证) 将当前用户的对象属性“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/

相关文章:

JavaScript 使用一个链接打开两个网页

javascript - LiveValidation - 将验证消息更改为图片?

javascript - 使用javascript显示具有唯一id的html标签标签中数组中的文本

firebase - 如何在控制台中查看 Firebase 存储使用情况

javascript - CSS:x 和 y 上的中心元素

javascript - JQuery $.ajax 302 仅在第一次调用时重定向

firebase - Firestore 的最大同时连接数是多少?

sql - sql中firebase的集合和文档的等价物是什么?

swift - 如何在 Firebase 中使用完成处理程序

java - 将 1 位小数的 double 转换为 2 位小数