Skip to main content
BackAnt ships a role_required decorator alongside token_required in api/decorators/token_required.py for role-based access control.

The role_required decorator

Protecting a route by role

Apply @token_required first to authenticate, then @role_required to check the role.

Implementing role validation

Add your role-checking logic in the wrapped function. A typical pattern with JWT claims:

Response for unauthorized roles