Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> storing the "real" expiration in cache so that it can be extended (or revoked) as needed.

You can also have a password_last_changed field on your user model, where any token issued before this date is considered invalid. That was if a user's account somehow gets compromised, all they need to do is change their password and then all of their existing sessions are expired automatically.

I can't think of any good reason for storing the expiration dates of each individual token, although maybe there is a use case somewhere.



Your missing the whole point. If the server was to track password_last_changed it might as well just track user_currently_loggedin.


No, there is a huge difference in write load between those two options.


But it's not RESTful which was the entire purpose of JWT.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: