r/FastAPI • u/SmallReality8212 • Sep 18 '25
Question How to implement logout
So I've seen very few posts regarding this and I honestly haven't figured out how to do it. I've come across some answers that talk about balcklisting/whitewashing etc. But I don't want to be storing these tokens on backend. Rn I'm implementing the project using fastapi, oauth for backend, react for frontend. How does one implement it in a production grade project? Is it entirely handled on frontend and I just redirect to login page or does the backend also handle logout functionality and clear access and refresh tokens
Edit: For the authentication I'm using oauth2 with jwt for access and refresh tokens
Also do I need to store refresh tokens on the backend
View all comments
Show parent comment
1
u/SmallReality8212 Sep 18 '25
Honestly I'm not very sure about it, I've just started working on it and my company doesn't seem to implement much on the authentication side. I've seen a project where they just clear cookie and redirect to login page. But from what I understand they don't want to store the tokens on backend, is it possible to implement it another way? Maybe generate different invalid tokens or something? But honestly I don't think that will deal with the case of a token being stolen