Role-Based Access Control Using Dependency Injection (User Roles) - FastAPI Beyond CRUD (Part 13)

Опубликовано: 12 Октябрь 2024
на канале: Ssali Jonathan
1,455
43

Role-Based Access Control Using Dependency Injection
In this video, we’re setting up role-based access control for our API project. Role-based authentication controls who can do what based on their role in the app. 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 make sure everything runs smoothly.

#python #fastapi #apidevelopment

SOURCE CODE:
https://github.com/jod35/fastapi-beyo...

COURSE WEBSITE:
https://jod35.github.io/fastapi-beyon...

PLEASE DONATE TO THE CHANNEL THROUGH:
BUY ME A COFFEE:
https://buymeacoffee.com/jod35

PATREON:
  / jod35  

You can also consider Becoming a member of this channel.

FOLLOW ME:

X:
https://x.com/jod35_

GITHUB:
http://github.com/jod35


Timestamps:
(00:00:00) Introduction
(00:02:08) Get current user
(00:12:43) Add roles to users
(00:19:28) Implementing a role checker dependency
(00:25:29) Add role checker to API paths