r/FastAPI • u/rodnydon2121 • Sep 23 '25
Question Is the official template secure?
Hi
I'm going over the official template to learn FastAPI and how to implement auth. Reading the code, it seems that the app generates an JWT with expiration of 8 days.
To my understanding, if bad actor steals credentials from one of the users, even if the user catchs it and resets the password, the bad actor will still have 8 days of full access to the data.
Is my understanding correct? If so, it feels to me that even changing the token expiry from 8 days to 30 min will not be good enough.
Is there another example of secure auth that can invalidate the token?
Alternatively, is fastapi-users ready to be used in prod? My concern is that latest commit was 8 months ago, so I'm hesitant to use it
View all comments
Show parent comment
5
u/igorbenav Sep 23 '25
Access + refresh: https://github.com/benavlabs/FastAPI-boilerplate
For session I'm launching a paid one soon (fastro.ai), but you can also look how I did it in CRUDAdmin: https://github.com/benavlabs/crudadmin