firebase-admin-node icon indicating copy to clipboard operation
firebase-admin-node copied to clipboard

[FR] - bulk update/edit auth users

Open ganey opened this issue 3 years ago • 6 comments

Is your feature request related to a problem? Please describe. It is not currently possible to bulk update a large amount of users customClaims in a single request, using a js map makes lots of requests and reaches rate limits very quickly. e.g users.map(user => firebaseAdmin.auth().setCustomUserClaims(user.uid, user.claims));

Removing users then re-importing with bulkImport would logout all current users from web/mobile apps, it would also require users to set new passwords again so this isn't an option.

Describe the solution you'd like add bulkUpdate or bulkEdit command that matches users by uid or email and updates matching records

Describe alternatives you've considered putting updates onto a queue and processing them individually within the firebase customClaims rate limits

Additional context even the ability to run small bulk updates such as 10 or 100 would be better than processing individually

example use case: B2B with several "clients" all in one firebase account. A client gets an upgrade and all the users gain a new feature, a new attribute needs adding to each users custom claims

ganey avatar Feb 17 '22 14:02 ganey

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

google-oss-bot avatar Feb 17 '22 14:02 google-oss-bot

This is currently handled by the code here which calls https://cloud.google.com/identity-platform/docs/reference/rest/v1/accounts/update#request-body and sets custom attributes.

The backend API provides batchCreate, batchGet and batchDelete - https://cloud.google.com/identity-platform/docs/reference/rest#rest-resource:-v1.projects.accounts, but no batchUpdate.

prameshj avatar Feb 24 '22 22:02 prameshj

following...

Junaid-Ahm avatar Mar 07 '22 16:03 Junaid-Ahm

I'm guessing the limits are those described here: https://firebase.google.com/docs/auth/limits#api_limits

Operations per service account | 500 requests/second

Which IMO is a relatively small amount.

What happens if you want to edit every single user to have a new field set on them? How would Google approach this use-case?

Even 10,000 users would probably be around a minute to update, as you wouldn't want to consume right up to the request limit as your application users would then be affected by the rate limiting.

ganey avatar May 12 '22 15:05 ganey

@prameshj This is still a blocker for me (I'm sure it must affect others)

Does the firebase team/google have any intention of supporting this in the near future?

ganey avatar Jun 01 '22 15:06 ganey

Hi Ganey, The backend API currently does not support this feature and that is required before we can add the feature to Admin SDK. I have opened an internal issue for the same and will share updates here. Thanks.

prameshj avatar Jun 01 '22 21:06 prameshj

I also need this bulk update feature. Is there any updates since Jun?

JaydipKalkani avatar Dec 11 '22 06:12 JaydipKalkani

Thanks for the reminder. We are still waiting for backend support. I have pinged for an update on the internal tracking bug - b/234611522

prameshj avatar Dec 12 '22 06:12 prameshj

Hey @prameshj just wondering if there are any updates on this? Thanks

ganey avatar Mar 13 '23 09:03 ganey