Lorixen.
EN

Session timeouts that don't lose your users' work

Short answer: Session timeouts protect accounts, but badly designed ones throw away people's work. Set the timeout length according to how sensitive the app is, warn users before it expires with a simple way to stay signed in, save work as they go, and let them pick up where they left off after signing back in. Accessibility guidance asks for a warning with at least 20 seconds to extend, and a re-login that doesn't lose data is the gold standard.

"Your session has expired. Please log in again." Then the half-written report, the long quote or the client intake form is gone. It's one of the most common complaints about business web apps, and one of the easiest to design out. Below are the mistakes we see most often, with what to do instead.

Mistake 1: Picking a timeout length without thinking about risk

Some apps log people out after five minutes because "shorter is safer"; others never time out at all. Both are choices, and both should be deliberate.

Instead: match the timeout to the app's risk and how people use it. The OWASP Session Management Cheat Sheet notes that idle and absolute timeouts depend heavily on how critical the application and its data are. It gives common idle timeout ranges of 2–5 minutes for high-value applications and 15–30 minutes for low-risk ones, and suggests that an app used by an office worker all day might have an absolute timeout of 4–8 hours. An internal job-scheduling tool and an app showing financial records shouldn't share the same settings.

Mistake 2: Expiring silently

The user comes back from a phone call, types for ten minutes, presses Save, and only then learns they were logged out. The work is lost because the app never said anything.

Instead: warn before expiry. A small dialog, "You'll be signed out in 2 minutes for security. Stay signed in?", with one button to extend.

W3C's WCAG guidance on adjustable timing describes this pattern: the user is warned before time expires and given at least 20 seconds to extend the limit with a simple action, and is allowed to extend it at least ten times. Make the warning accessible: announced to screen readers, focusable from the keyboard, and not dependent on a mouse hover.

Mistake 3: Measuring "idle" wrongly

Some apps only count server requests as activity. A user typing a long note in a single text box makes no requests, so the app thinks they've been idle and logs them out mid-sentence.

Instead: treat meaningful client-side activity (typing, scrolling, clicking within the app) as activity for warning purposes, and refresh the session when the user chooses to stay signed in. OWASP describes the idle timeout as measured from the last request the server received for that session, which is exactly why long, request-free editing is at risk unless the app accounts for it.

Mistake 4: No autosave

Even with warnings, people walk away. A forgotten laptop shouldn't mean a lost afternoon of work.

Instead: save drafts automatically: to the server every so often while the session is valid, or to local storage in the browser as a fallback. Show a quiet "Draft saved 1 minute ago" indicator so users trust it. For long forms, save step by step.

Be careful with sensitive data in browser storage on shared computers: store only what's needed, and clear it once the draft is safely saved on the server.

Mistake 5: Losing context after re-login

The user signs back in and lands on the dashboard, not on the form they were filling in, which is now empty.

Instead: after re-authentication, return users to where they were with their data intact. WCAG's re-authenticating criterion (a stricter, AAA-level guideline) states the goal plainly: when an authenticated session expires, the user can continue the activity without loss of data after re-authenticating. Even if you don't aim for full AAA conformance, this is the experience users expect.

Technically, that usually means preserving the draft (server-side or locally), remembering the return URL, and restoring the form after login.

Mistake 6: Expiring on the server only

The opposite failure: the app shows a friendly screen, but the session is still valid on the server, or the server expires it while the browser keeps showing private data.

Instead: handle expiry on both sides. OWASP says that when a session expires, the application must actively invalidate it on the client and the server, with the server side being the essential part for security. When the session ends, hide sensitive data on screen as well, so an unattended screen doesn't keep displaying it.

Mistake 7: One rule for every action

Some actions deserve fresh confirmation regardless of the session: changing a password, adding a payee, exporting all customer data.

Instead: keep the general session comfortable, and ask for re-authentication only for high-risk actions. This lets you avoid punishingly short timeouts for everyday work while still protecting what matters most.

Mistake 8: Ignoring "remember me" decisions

Users on their own laptop want longer sessions; users on shared front-desk computers need shorter ones. A single setting can't suit both.

Instead: offer a clear "Keep me signed in on this device" option with a sensible maximum, and set shorter defaults for shared devices or roles that use them.

Mistake 9: Never asking users

Timeout complaints often reach support as "the app is buggy" rather than "the timeout is too short".

Instead: log session expiries along with whether a draft was saved, and ask a few users how they work. If people regularly lose work at a particular step, that's where the next fix belongs.

A quick checklist

  • Timeout lengths chosen deliberately for the app's risk.
  • Warning before expiry, with a one-click extend, accessible to keyboard and screen readers.
  • Typing counts as activity for warnings.
  • Autosave with a visible indicator.
  • Return to the same place, data intact, after re-login.
  • Server and client both invalidate the session.
  • Re-authentication for high-risk actions.

FAQ

What's a good timeout for an internal business app?

It depends on the data. OWASP's common ranges run from 2–5 minutes for high-value apps to 15–30 minutes for low-risk ones. Many internal tools sit at the low-risk end.

Do we need a warning dialog?

For a good experience, yes, and accessibility guidance recommends warning with at least 20 seconds to extend.

Is autosave a security risk?

It can be if sensitive data is stored carelessly in the browser. Save to the server when possible and keep local storage minimal.

Should mobile apps behave the same way?

The principles are the same. Mobile apps often use device unlock and biometrics to make re-authentication quicker.

If users of your web app keep losing work to timeouts, tell us which screens it happens on and we'll suggest timeout, warning and autosave settings that fit. More about the business web apps we design and build is on our web app development page.

Sources

WhatsAppLet’s talk