将已验证的Firebase用户的isEmailVerified设置为false [英] Set isEmailVerified of already verified firebase Users to false

查看:105
本文介绍了将已验证的Firebase用户的isEmailVerified设置为false的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每年我都希望我的Firebase用户再次验证其帐户电子邮件,以检查其电子邮件地址是否仍在使用中.

Every year i want my Firebase users to verify their account-email again, to check that their Email address are still in use.

要对此进行测试,我向我(已验证的)帐户发送了一封新的验证电子邮件.邮件已发送,但是没有设置为.isEmailVerified为false,也就是重新加载currentUser和应用程序之后.

To test this i sent a new verification email to my (already verified) account. The mail was sent, but this did not set my .isEmailVerified to false, also after reloading the currentUser and the app.

有人知道是否可以将.isEmailVerified设置为false,一旦它为true,怎么做?

Does anyone know if it´s possible to set the .isEmailVerified to false, once it is true at all, and if so how to do it?

推荐答案

发送验证电子邮件不会将emailVerified属性设置为false.这是预期和预期的行为.

Sending a verification email does not set the emailVerified property to false. That is the expected and intended behavior.

如果要将用户的emailVerified属性设置为false,则可以使用Firebase Admin SDK进行设置.例如,在Node.js中,它将是:

If you want to set the emailVerified property of a user to false, you can do so with the Firebase Admin SDK. For example, in Node.js it would be:

admin.auth().updateUser(uid, {
  emailVerified: false
})

有关更多示例(包括其他语言)的信息,请参见 Firebase文档关于更新用户个人资料.

For more examples (including in other languages) see the Firebase documentation on updating a user profile.

请注意,Admin SDK具有对Firebase项目的完全管理访问权限,因此只能在受信任的环境中运行,例如您的开发计算机,您控制的服务器或Firebase的Cloud Functions.在任何情况下,您都不应尝试将此功能放到您使用的应用程序中,因为这样做会使他们具有对Firebase项目的管理访问权限.

Note that the Admin SDK has full administrative access to your Firebase project, so should only be run from a trusted environment, such as your development machine, a server you control, or Cloud Functions for Firebase. In no instance should you try to put this functionality in the app you give to your uses, as doing so will give them administrative access to your Firebase project.

这篇关于将已验证的Firebase用户的isEmailVerified设置为false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆