且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何仅在 Firebase 3 中创建用户而不对其进行身份验证?

更新时间:2023-09-28 21:12:40

问题的答案是:你不能.

The answer to the question is: you can't.

我们有类似的情况,我们有可以创建其他用户的管理员"用户.使用 2.x 这很容易.对于 3.x,这是一个失败,因为该功能已被完全删除.

We have similar situation where we have 'admin' users that can create other users. With 2.x this was a snap. With 3.x it's a fail as that capability was completely removed.

如果您在 3.x 中创建一个用户,则您以该用户身份进行身份验证,并取消对登录帐户的身份验证.

If you create a user in 3.x you authenticate as that user, and unauthenticate the account that's logged in.

这更深入,因为您需要重新进行身份验证以创建另一个用户;所以管理员要么手动执行此操作,要么(畏缩)在本地存储身份验证数据,以便它可以是一个自动化过程(畏缩畏缩,请不要这样做)

This goes deeper as you would then need to re-authenticate to create another user; so the admin either does that manually or (cringe) stores the authentication data locally so it could be an automated process (cringe cringe, please don't do this)

Firebase 公开强调将继续支持 2.x,因此您可能只想避免使用 3.x.

Firebase has publicly stressed that 2.x will continue to be supported so you may just want to avoid 3.x.

更新:

其中一位 Firebaser 实际上想出了一个解决方法.从概念上讲,您有一个 admin 用户登录.然后您创建第二个连接到 firebase 并与另一个用户进行身份验证,然后该连接创建新用户.冲洗 - 重复.

one of the Firebaser's actually came up with a workaround on this. Conceptually you had an admin user logged in. You then create a second connection to firebase and authenticate with another user, that connection then creates the new user. Rinse - repeat.

再次更新

查看此问答

Firebase 踢出当前用户