Trying to figure out what is the best practice when session times out so that i can do it right first time around.

Assume user logs into a web app and goes to "/events" page, where they stay till token expires after 15 minutes. When it expires and of course notifies the user (e.g. via alert), it would redirect to the login page.

When user signs in again, should the user be taken to the default landing page (e.g. /dashboard) or should it take them back to "/events" page.

What is better practice?

  • 4
    I think it depends on requirements and the specific website/webapp in question. If you do decide to bring them back to the last page you were on, keep in mind you'll then have to store that information somewhere, so it is an added complexity. – neilsimp1 May 23 '17 at 12:11
  • What does better means for you? – Laiv May 23 '17 at 21:00
  • @neilsimp1 thanks mate. Good points there definitely. – Aeseir May 24 '17 at 7:31

It depends on the specific page. In case the user was on a page that was part of a transaction, you want app to move to landing page. If it is a page that was not part of a transaction, you want app to move to the specific page. Let's consider Amazon for example.

If the user is currently in payments page, adding the voucher and the timer expires, you must bring him/her back to the starting page of the transaction (cart view), or the login page. If the user is currently on the help page, you should ideally bring him/her back to the help page.

The best method that I believe in, is to maintain the state and bring user back to the last checkpoint. In case of help page, that checkpoint will be the help page. In case of "contact support" page, it will be again the help page. In case of payments page, it will be the cart view page.

Obviously, this method requires application to maintain the data across sessions, which requires extra development work. Although, it is possible to do a common function that saves data when session ends, saving some development work.

| improve this answer | |
  • Right so in summary if it is a transaction then go back to a checkpoint, if non transaction then completely optional depending on what user experience. – Aeseir May 24 '17 at 7:33
  • If non transaction, then also move to the last checkpoint, otherwise correct. :) – jitendragarg May 24 '17 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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