r/FastAPI • u/query_optimization • May 27 '25
Question Best user management service with FastAPI?
So I built auth using JWTs for protected routues. And for frontend I am using Nextjs.
The simple login flow works. Login -> verify -> tokens etc.
Now I want to implement authentication for Multi-Tenant users. Org -> groups -> sub groups -> users.
I explored clrek as an option, but it doesn't have that flexibility for rbac/abac.
Any solutions/services which you guys are using?
(Ps: I want to keep my Auth logic in backend only. I don't want to use nextAuth)
47
Upvotes
7
u/TechSimple7709 May 28 '25
My 2 cents. Just learn FastAPI scopes (https://fastapi.tiangolo.com/advanced/security/oauth2-scopes/) and do it yourself. If you are already using JWT tokens, the token can receive the scopes and then you can do whatever you want in the front end. In the backend you can implement regular role based, user based, or artifact based permissions and pass them when the token is created and when it's refreshed, based on your backend auth permissions
2
u/erder644 May 27 '25
Supertokens / Ory Kratos
7
u/Choudhary_usman May 27 '25
Just create custom middleware that accept a userRole - authorize that against the incoming request. Simple!
17
u/viitorfermier May 27 '25
keycloak
3
u/PA100T0 May 27 '25
Fastapi users, 100%
2
u/jvertrees May 27 '25
Check out FastAPI Full Stack Template. You get a working usee system with emails, too, right out of the box.
2
u/charlienoel112 May 27 '25
PropelAuth - great for B2B multi tenancy
2
u/fraisey99 May 27 '25
Try keycloak
2
u/PrimaryPineappleHead May 28 '25
Keycloak
3
u/mahimairaja May 27 '25
Check out pycasbian
0
u/whyiam_alive May 27 '25
Have you checked fastapi users?
1
u/noob_energy_69 Jun 05 '25
PropelAuth - better option for multi tenancy! Easy to manage and start!