How can I list all users using firebase admin sdk

拈花ヽ惹草 提交于 2019-11-29 14:17:53

Update As @Webp says in their answer, there is now an API to list all users in the Admin SDK.

Original answer:

There is no public API to retrieve a list of users from the Firebase Admin SDK.

The typical way to deal with this scenario is to keep a list of the pertinent user information in the Firebase Database. See this original question for more: How do I return a list of users if I use the Firebase simple username & password authentication

The latest firebase-admin sdk (as of now version 5.4.2) has listUsers API that would do that. The example is here.

One thing to add to the example, the nextPageToken has to be omitted or a valid userid. (IMO, it's not obvious in neither the example or the API doc.)

Its not a good solution, but you can export user data using Firebase CLI and integrate with your application.

auth:export

firebase auth:export account_file --format=file_format

https://firebase.google.com/docs/cli/auth

You can use auth().listUsers() method provided in the admin sdk. Detailed example code can be found here. Firebase Admin SDK Documentation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!