Management API v2 /api/v2/users/{id}/roles gives error 400 with message Schema violation

When I try to assign a role to a user it respondes with a 400 status code with messagem Schema violation.

Both images are of the same request, but one shows de body and another the Headers

You need to use the ROLE_ID, not the role name when using this API.

You can get the ROLD_ID for a role by fetching the roles from: /api/v2/roles

9 Likes

This distinction should be made clear in https://auth0.github.io/node-auth0/module-management.ManagementClient.html#assignRolestoUser which shows sample code that makes it look as though you can send the role name as the parameter to this method.

2 Likes

Thank you a lot @harmoN for sharing that knowledge and @wwarby for providing that feedback! I’ll make sure to relay it to appropriate team!

Any chance the Role Id could also be displayed on the dashboard? Would save a lot of hassle.

2 Likes

Hey there!

Not sure about it @jeffeld but you can always submit feedback to our product team including all the context:

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