DEV Community

Ssali Jonathan
Ssali Jonathan

Posted on

Role-Based Access Control Using Dependency Injection (Add User Roles)

In this video, we’re setting up role-based access control for our FastAPI project. Role-based access control control allows users to perform actions in an application basing on their role.

We create roles for users and admins, and then check these roles for every API endpoint. This way, we protect our API endpoints so only users with the right role can do certain things. We use dependency injection to implement this.

Top comments (0)