Firebase Auth-按自定义声明列出的用户 [英] Firebase Auth - list of users by Custom Claims

查看:71
本文介绍了Firebase Auth-按自定义声明列出的用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在Firebase Auth中使用自定义声明来管理Firebase中的访问并允许自定义UI体验.

We're using Custom Claims in Firebase Auth to manage access in Firebase and allow custom UI experience.

我们现在正在研究User Admin部分,我们找不到通过自定义声明检索用户的方法.

We're now working on the User Admin part and we can't find a way to retrieve users by the custom claims.

例如,用户属于组织,并且具有不同的访问级别-管理员或用户. 我们需要允许组织的管理员查看其所有组织的用户.

For example, a user belongs to an organization and have different access level - admin or user. We need to allow the organization's admin to see all their organization's users.

我们希望避免使用单独的数据库来管理组织用户,以免使数据加倍.

We'd like to avoid using a separate database to manage organization users to not double up the data.

有可能吗? 在通过特定的自定义声明过滤用户时,我们是否可以检索所有Auth用户?

Is it possible? Can we retrieve all Auth users while filtering them by specific Custom Claim?

谢谢!

推荐答案

没有内置的API可以获取具有特定声明的所有用户的列表.

There is no built-in API to get a list of all users that have a specific claim.

个API,用于获取 Admin SDK中所有用户的列表.因此,您可以使用它,然后过滤具有您要查找的声明的用户.

There is an API to get a list of all users in the Admin SDK. So you could use that and then filter the users that have the claim you're looking for.

但是这种表现不会很出色.因此,如果列出具有特定声明的所有用户是您应用的常见用例,则您需要重新考虑对使用额外位置存储数据的担忧.复制数据以实现(良好执行)用例在NoSQL中非常普遍.

But performance of this will not be spectacular. So if listing all users with a specific claim is a common use-case for your app, you'll want to reconsider your concern about using an additional place to store the data. Duplicating data to achieve (well performing) use-cases is quite common in NoSQL.

这篇关于Firebase Auth-按自定义声明列出的用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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