Role assignment
Stytch's RBAC framework uses Role assignment to delegate access controls. Rather than granting permissions one by one, Userss are assigned Roles that grant them sets of permissions.
Explicit role assignment is when you directly assign (or revoke) a Role to a specific User object with an API call. Once assigned, the User has that Role unconditionally until it is explicitly revoked. Explicit assignment is a singular operation between a specific Role and an individual User.
The following API endpoints support explicit Role assignment.
Below is an example of explicitly assigning the admin Role to a specific User via the Update User endpoint.
curl --request PUT \
--url https://test.stytch.com/v1/users/user-test-16d9ba61-97a1-4ba4-9720-b03761dc50c6 \
-u 'PROJECT_ID:SECRET' \
-H 'Content-Type: application/json' \
-d '{
"roles": ["admin"]
}'
Alternatively, you can also explicitly assign or remove Roles in the Dashboard by navigating to a specific User on the Users page.
What's next
Check out our integration guide to start enforcing authorization with Stytch.