且构网

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

从firebase中删除用户

更新时间:2023-12-01 23:16:10

Firebase简单登录是基于 Firebase自定义登录,并提供有用的原语,用于通过常用方式验证用户。

Firebase Simple Login is a service built on-top of Firebase Custom Login, and provides useful primitives for authenticating users via common means.

按照设计,Firebase Simple Login可以不允许您以编程方式访问用户的密码,因为它只会增加不安全处理或存储密码的风险。今天,可用于删除电子邮件/密码哈希映射的唯一两种方法是使用电子邮件和密码通过客户端API,或通过 https://< YOUR-的管理面板FIREBASE> .firebaseio.com

By design, Firebase Simple Login does not give you access to the users' passwords programmatically, as it only increases the risk that they are not handled or stored securely. Today, the only two methods that can be used to remove an email / password hash mapping is either via the client API using the email and password, or via the admin panel at https://<YOUR-FIREBASE>.firebaseio.com.

请记住,在使用电子邮件/密码登录时,Firebase简单登录只会创建一个新的映射电子邮件地址和密码哈希,但不会在您的Firebase中存储任何信息。另请注意,无法将用户ID黑名单,因此如果删除映射,用户可以重新创建它。

Keep in mind that when using email / password login, Firebase Simple Login simply creates a new mapping between an email address and a password hash, but does not store any information in your Firebase. Also note that there is no way to "blacklist" a user id, so if you remove the mapping, the user could re-create it.

如果要禁止/阻止用户,更好的方法是在黑名单用户的Firebase中创建一个新列表,然后使用安全规则确保该用户在列表中(即用户被阻止,如果 root .child('blocked-users')。hasChild(auth.uid))。

If you want to ban / block users, a better approach would be to create a new list in Firebase of your "blacklisted" users, and then use security rules to ensure that that user is in the list (i.e. user is blocked if root.child('blocked-users').hasChild(auth.uid)).