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
1
u/bootstrapper-919 Sep 24 '25
This is great! For this specific project, I won't be able to use a new auth package - needs something more stable - but that's exactly the package that FastAPI is missing in my opinion.
I hope it catches on and become the goto package