如何仅在 Firebase 3 中创建用户而不对其进行身份验证? [英] How to just create an user in Firebase 3 and do not authenticate it?

查看:23
本文介绍了如何仅在 Firebase 3 中创建用户而不对其进行身份验证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个 angularfire 项目,我想知道如何在 Firebase 3 中创建用户,并且一旦完成,不要对指定用户进行身份验证.在之前的 Firebase 版本中,我们有一个名为 createUser(email, password) 的方法.现在我们只有 createUserWithEmailAndPassword(email, password) 方法,它创建并验证指定的用户.

I am working on a angularfire project and I would like to know how can I create an user in Firebase 3 and once done, do not authenticate the specified user. In the previous Firebase version we had the method called createUser(email, password). Now we have the method createUserWithEmailAndPassword(email, password) only, it creates and authenticates the specified user.

推荐答案

问题的答案是:你不能.

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 踢出当前用户

这篇关于如何仅在 Firebase 3 中创建用户而不对其进行身份验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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