【发布时间】:2019-07-13 13:30:45
【问题描述】:
我正在尝试使用 firebase auth admin 向用户发送电子邮件验证。所有示例似乎都使用 firebase.auth().currentUser;但是,在我的情况下,我以管理员用户身份登录,查看用户的自定义仪表板列表以执行操作,而不是以个人用户身份登录。
我可以使用这种方法成功地更改用户记录,方法是将 UID 传递给 updateUser 方法和更改...例如
let userRecord = await fbAuth.updateUser(blogUID, {
email: req.body.BloggerEmail
})
并且可以检索我想要使用的用户的用户详细信息:
var userA = await fbAuth.getUser(blogUID)
但是,此方法返回的用户对象不允许我调用 sendEmailVerification 方法(似乎 getUser 不会返回与 getCurrentUser 相同的对象类型
try {
var userA = await fbAuth.getUser(blogUID).sendEmailVerification()
console.log("Sent new verification email");
} catch(error) {
console.log("Error sending verification email " + error);
}
[失败,sendEmailVerification 不是方法]
我尝试使用的官方参考文档: https://firebase.google.com/docs/auth/web/manage-users#send_a_user_a_verification_email
感谢您的帮助。
【问题讨论】:
标签: javascript firebase firebase-authentication firebase-admin