Sessions
A session is what keeps a person signed in between page views. When someone signs in to your app, the server creates a session and the browser stores a cookie for it. The session lasts 30 days unless the person signs out, is disabled, or resets their password.
Sessions
A session is what keeps a person signed in between page views. When someone signs in to your app, the server creates a session and the browser stores a cookie for it. The session lasts 30 days unless the person signs out, is disabled, or resets their password.
When to use this page
- You want to know how long users stay signed in.
- Users report being "logged out" unexpectedly.
- You want a friendly page when a session has expired.
How sessions work
- One cookie per app and per data environment. A session on the staging app (test data) is separate from a session on the live app (live data). Signing in to one does not sign you in to the other.
- Expiry: 30 days after sign-in. There is no "remember me" option; every session uses this length.
- Sign out: the Sign out icon in the navigation, the Sign out button on
/account, or a button with the Sign out action. Signing out deletes the session on the server and returns to the home page. - Disabled users: switching a user to Disabled in Users → App users signs them out everywhere immediately.
- Password reset: completing a reset signs out all other sessions of that user.
- Deleting a user removes their sessions.
Session expired
When a signed-in visitor's session is no longer valid (expired, disabled, or signed out elsewhere) and the app notices while loading data:
- The app re-checks the user with the server.
- If the session is really gone, the visitor is taken to your Session expired page if you configured one (Settings → System pages → Session expired; it must be a public standard page), with the current address passed as
next. - Otherwise they go to
/loginwith the message "Your session has expired. Please sign in again." After signing in they return to where they were.
Builder preview
In the builder there are no app sessions. You pick a role with Preview as (and optionally an email for "own records" rules), and the preview behaves as that user. Sign-in and sign-out forms are simulated there.
Common mistakes
- Expecting a session to carry over from staging to live. They are different environments with different users.
- Blocking cookies. The app cannot keep anyone signed in without its cookie.
- Protecting the Session expired page. It must be public, or the visitor loops back to sign-in.
- Testing expiry by deleting the cookie only. The server-side session still exists; disable the user or sign out to invalidate it.
Related
Advanced
Cookie name mab_app_<projectId>_<env>, httpOnly, SameSite=Lax, Secure in production, 30-day expiry. The database stores sha256(token) in app_sessions with project_id and env; requests resolve the user from it on every call. A 401 on the live or staging channel triggers the session-expired handling in the app shell.