I am working on an android app based on Firebase and I am creating registration using authentication of users with their email addresses and passwords with method signInWithEmailAndPassword, I am able register multiple users and also able to see user on Firebase console. But, I want to get the list of all the registered users on Firebase Auth. I can get the current user using FirebaseAuth.getInstance().getCurrentUser(). But, I want to list all the registered users. So, is there anyway I can get the list of registered users?
Asked
Active
Viewed 4.7k times
24
Ojonugwa Jude Ochalifu
- 26,627
- 26
- 120
- 132
Lalit Poptani
- 67,150
- 23
- 161
- 242
-
14This question was *not* answered in the linked question. The linked question mentions getting a list of users in the title, but the actual question content is about users not showing up in the Firebase Console. Nowhere in that question do they address how to programmatically access a list of all registered users. – odigity Nov 26 '16 at 10:32
-
4How is this a duplicate again? – Ojonugwa Jude Ochalifu Dec 27 '16 at 08:24
-
2latest firebase-admin sdk has this feature - https://firebase.google.com/docs/auth/admin/manage-users#list_all_users – Dipen Dedania Jan 22 '18 at 09:07
-
For anyone coming here confused the (web) API still doesn't include admin. Then confused more by someone saying it does now. Again auth and admin are two separate things. "The Firebase Admin SDK allows you to integrate your own servers with Firebase Authentication." – JustDave Aug 11 '20 at 00:17
1 Answers
12
You can't
The explanation is here How do I return a list of users if I use the Firebase simple username & password authentication
You can instead set the user's uid to users node in your database, I use that node to store other user's information. then you can get the number of childs under that node.
Wilik
- 7,630
- 3
- 29
- 35
-
12Why doesn't firebase do this automatically? Now I have to create an extra node and also keep it in sync in case of user deletions. And it will clutter my already lagging firebase console! User also has to send an extra request to the server.. – EralpB Nov 20 '16 at 19:32
-
13The question you linked to does *not* answer the question of how to programmatically retrieve a list of all registered users. – odigity Nov 26 '16 at 10:33
-
@Wilik can you provide more details? Is there a public repo where I can take a look? I'm currently only using FB for authentication. E.g., by "users node" you mean create a top-level node called "users" and store data there? When are you notified that a user has logged in for the first time? What if you drop that data? Would you then just implement a create-if-not-found method? Thanks. – rsb Dec 01 '16 at 00:13
-
2@odigity, it's not possible to retrieve a list of all registered users from Firebase Authentication, the link I provided only explains why it's not possible and gives you and alternative (by storing the details in Firebase Database) – Wilik Dec 01 '16 at 08:03
-
@rsb _by "users node" you mean create a top-level node called "users" and store data there?_ yes. And yes, I implement the "create if not found" method for the "users" node. I can't find any documentation/repo about this, this is my own way to save the user details in the database :D – Wilik Dec 01 '16 at 08:34
-
2Has this changed since 2016 or do we still have to create a top level users collection to store users' data? – Van Du Tran Nov 24 '17 at 18:07
-
9In case someone missed, now you can. https://firebase.google.com/docs/auth/admin/manage-users#list_all_users – Alvin Konda Feb 03 '20 at 20:35