Auth(0) Authorization Extension bulk add users to groups

Hi,
I have setup groups and roles in authorization-extension but I have over 1000 users that I need to assign to the groups/roles. Is there any way I can bulk update the users to assign them to the groups ?

Thanks
Evanna

If you have enabled the extension’s API, you can use the add group members endpoint to add users to a group: Authorization Extension API Explorer

In the request body, you can pass an array of user IDs, so they will be bulk added.

2 Likes

Hey @evanna.mcmahon!

As @thameera mentioned, the easiest way to achieve that would be by using our Authorization Extensions API.

Hope it helps!

1 Like

Thanks I’ll try that

Thanks Thameera,

Sorry I am new to auth(0). I have the extensions API enabled but I don’t know how to access the API Extension. Do I use the API Extension URL ? This is just displaying a blank page. Where do I update the request body ? and how do I pass an array of user ids ?

Thanks
Evanna

You can call the API via a tool like Postman or a command line utility like cURL. A cURL request might be similar to this:

curl -X PATCH \
 https://TENANT.us.webtask.io/adf6e2f2b84784b57522e3b19dfc9201/api/groups/GROUP_ID/members \
  -H 'Authorization: Bearer API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '["auth0|5a86c5d2a350a48bf2024576", "auth0|57a96fe8e618d33da2f90891"]'

The API_TOKEN can be generated from the Auth0 dashboard. I highly recommend going through this document first: https://auth0.com/docs/extensions/authorization-extension/v2/api-access

To break this down:

  • It will be a PATCH request
  • The API endpoint will be of the format in the example above. The exact API URL prefix can be found in the API section in the extension.
  • An API token needs to be passed, and this can be generated by going to Auth0 dashboard → auth0-authorization-extension-api → Test tab
  • In the body of the request, send an array of user IDs you want to add to the group.

Does that help?

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.