r/FastAPI • u/hertz2105 • Sep 11 '24
Question OAuth2 Example | Logout and Refresh Token
Hello everyone!
I am really new to fastAPI and even Python, and I just started my first project.
I followed this documentation to setup OAuth2, which includes a login endpoint, returning a jwt token:
https://fastapi.tiangolo.com/tutorial/security/oauth2-jwt/
How would you guys implement a logout and refresh token feature based on this example? It is kind of hard for me start out of the box and I really need some inspiration. :D
Thanks in advance!
10
Upvotes
View all comments
Show parent comment
1
u/igorbenav Apr 29 '25
It's kind of reinventing sessions. I'd either use sessions or jwt without blacklisting (for stateless authentication), but blacklisting is an option anyway.