Role-Based Access Control (RBAC) lets you define fine-grained permissions for members based on their roles. An RBAC policy is composed of roles, resources, and actions, defining who can do what within your application.Documentation Index
Fetch the complete documentation index at: https://stytch.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Using RBAC
Get your RBAC policy
Fetch your current RBAC policy using the Get Policy endpoint:Response:See Create RBAC Policy to set up your policy in the Dashboard.
Assign roles to members
Assign roles when creating or updating members:Members can have multiple roles, and their permissions are the union of all role permissions.
Check permissions
Enforce permissions by passing the member’s session token to API endpoints:Stytch automatically verifies the member has the required permissions before processing the request. If unauthorized, the request returns a
403 error.For custom resources, use Authenticate Session with the authorization_check parameter:RBAC policy structure
An RBAC policy consists of three components:- Roles - Named collections of permissions (e.g.,
admin,editor,viewer) - Resources - Objects members can access (e.g.,
documents,settings,reports). Stytch provides default resources likestytch.organizationandstytch.member. - Actions - Operations members can perform on resources (e.g.,
read,write,delete)
Learn more
Create RBAC policy
Set up roles and permissions in the Dashboard
Default roles and resources
View Stytch’s built-in RBAC configuration
Enforcing permissions
Backend and frontend authorization checks
Role object
Role object reference