0

Does the firebase admin sdk have a way of bulk editing users?

It has bulk methods for getUsers, deleteUsers and importUsers but no option for edit?

Edit: I've opened a github issue with google/firebase here

ganey
  • 556
  • 3
  • 14
  • I don't think it does but you might also want to take a look at this answer: https://stackoverflow.com/questions/58897274/what-is-the-fastest-way-to-write-a-lot-of-documents-to-firestore which might provide insight into how to make multiple write requests at once. – Abir Taheer Mar 09 '22 at 16:14
  • @AbirTaheer Thanks, that helps with multiple firestore writes at once, although it seems Google imposes a rate limit on the Auth sdk for editing users (around 500 requests/second) – ganey May 12 '22 at 14:31

1 Answers1

1

As far as I know, Firebase Auth in Admin SDK doesn't have any other methods except updateUser (docs) to update a single user. I'd suggest to retrive all users by UID, modify it, bulk delete all users by UID and then do import steps (import docs). Make sure to chunk your data by 1000 for every API call, because that's the API limit. Or, you can do looping updateUser one by one instead.

  • I wondered if bulkImport was safe to use to just update existing users, i could put the correct uid/email in and then it would work for bulk setting the custom claims. I'm not sure how it handles gaps in data (does it merge? or just replace with the new data) I tried using a map function to call updateUser but it's too easy to hit the rate limit and get the auth/quota-exceeded error – ganey Feb 17 '22 at 10:11