I am building a service for developers and I am wondering when I should "expire" a session. I obviously don't want my users to have to login every time they reload the page but I wouldn't want them to have to only login once and have complete access to their account forever either.

I have decided on "every 24h" and I wanted to see what the community has to say.

2 Answers 2


I reckon the easiest way to figure this out is to ask developers who are using your service. No need to guess. Get the data first, then you can decide.

  • Alright, I'll just do that. Thank You. Commented Apr 23, 2022 at 16:43

If you want to expire the user login after a limited constant time period, then you can use cookie with expire value, in node express server.

res.cookie('rememberme', '1', { expires: new Date(Date.now() + (1000 * 60 * 60 * 24)), httpOnly: true });

Else you can use session storage if you want to logout the user whenever he closes the current browser.

  • 2
    UX.stackexchange is about user experience and not about implementation. The question of the OP was WHEN a user should be required to re-login to their account.
    – Nash
    Commented Apr 20, 2022 at 7:26
  • Thanks Arif but as Nash explained, I wanted to know how long until the session token expires. Commented Apr 20, 2022 at 16:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.