-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Token expiration times #182
Comments
Hi @manuel-syone, the "easy" way to implement session expiration with JTWs is using the However, we use Redis to track sessions in our apps because it allows "Repudiation" i.e. invalidating a token before the expiration. (e.g. if someone reports their phone as stolen...) ... but this might be "overkill" for your situation so you need to make a judgement call. the amount of time you set for expiration entirely depends on they type of application you are building and the "perceived" security of session expiration e.g: banks usually log you out automatically after 10 mins but many social network apps will set expiration for a Month. I'd recommend following the "Accessibility" approach to session timeout. see: In my experience of observing many people (of all ages) using/testing web applications the ones who are "security" (privacy) conscious will always click the logout button before leaving the device whereas the rest expect their session to be preserved across sessions... are you able to ask your "users"...? There are obviously security considerations to session timeout: https://www.owasp.org/index.php/Session_Management_Cheat_Sheet#Idle_Timeout but these are mostly related to an attacker gaining physical access to the person's device, if that is the case you have bigger problems. For example you could log someone out if their IP address changes naively thinking that you are preventing "hackers" from hijacking a session, meanwhile you will have many false positives for people on mobile devices who change IP address each time they move cell towers and would thus be logged out multiple times per day. 😞 |
@manuel-syone please let us know if that answers your question ... if so we can add the answer to our "FAQ" and close this issue. (thanks!) |
@nelsonic Sorry for not answering sooner. Firstly, thank you for your great answer, it was very complete and explanatory! I believe this answers my question for now; at this point I moved to another task and I can't implement and test an approach using the |
Cool. Glad I was able to help. Closing this issue. 👍 |
@nelsonic The problem with the easy approach or even the Redis one, is that there is no activeDuration. e,g: the user does not understand what happened and why. so we need a way to define some sort of activeDuration: it sound like must have for any site that want a good user experience. |
Hello! I'm new to JWT, and I am having some troubles understanding the token invalidation after some time. Right now I am able to generate tokens and login and invalidate them on logout. Users with a valid token are able to access services on the back-end. How do I deal with the freshness issues of the token? What's a common policy for token expiration? Let me know if you need me to be clear on some aspect of this question.
The text was updated successfully, but these errors were encountered: