Skip to content
Workforce IdentityMarkdown

Sessions

What a sign-in gives the user, how long it lasts, how many one user may hold, and how a stronger sign-in upgrades it without starting over.

AvailableDashboard and APIOpenID Connect Core 1.0, RFC 8176

A successful sign-in gives the user a session: the realm’s record that they are signed in, how, and since when. You decide how long a session lasts, how long it may sit unused, and how many one user may hold at once. When an action needs more than the user’s current sign-in, a stronger chain upgrades the same session in place.

  • Who can do it: a realm administrator, in a group that holds RealmOwner (Delegated administration). RealmViewer can read the settings.
  • Where: session lifetimes and the quota, today through the API (Call the API shows how to get $CVYUH_SESSION); the sign-in timeouts, in the dashboard under Authentication → Settings or through the API. Live sessions are listed and ended through the API (Session management).

A sign-in is a short conversation at POST https://foobar.cvyuh.com/api/v0/am/auth/v1/authenticate. An empty body starts it, and the realm answers with a page of prompts and an authId. Each later request sends the authId and the answers, until the realm answers success or failure. Call the API walks through one.

  • The authId names one sign-in in progress. It ends on success, on any failure, and when the sign-in or the page times out. To try again, start again.
  • On success the realm gives a new session id. It never reuses the authId. Its cookies are HttpOnly, Secure and SameSite=Lax.
  • POST https://foobar.cvyuh.com/api/v0/am/auth/v1/logout ends the session.

A session records who signed in, the chain and modules they passed, the level reached, when, and from which address. It ends maxSessionMinutes after sign-in, or after maxIdleMinutes without use, whichever comes first.

One user may hold up to sessionQuota sessions at once, 10 by default. A sign-in past that ends the user’s oldest sessions until it fits; the new one is never the one ended.

Tokens read the session: acr from the chain, amr from the modules, and auth_time from the sign-in. See Step-up and re-authentication.

A chain named when a sign-in starts (?service=<chain>) runs only for a user who is already signed in to the realm. It knows who they are and when they signed in. When it succeeds, it upgrades the session:

  • The new session continues the earlier one’s sign-in lineage (its sid), so apps and tokens tied to it stay valid. The lineage ends when its latest session does.
  • The audit trail records SESSION_UPGRADED, naming both sessions.
  • Only the user’s own live session can be continued.

This is how an app asks for a stronger sign-in before a sensitive action, and how adding a passkey runs after sign-in.

Set how long sessions last and how many one user holds:

Terminal window
curl -X PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/sessionSettings/sessionSettings \
-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
-H "Content-Type: application/json" \
-d '{ "maxSessionMinutes": 480, "maxIdleMinutes": 30, "sessionQuota": 5 }'
  • The session lives in a browser cookie that ends when the browser closes. There’s no “stay signed in” choice: a user who closes their browser signs in again next time, unless the browser restores its cookies on restart.
  • A session that ends asks for a new sign-in. After maxSessionMinutes, or maxIdleMinutes without use, the next page that needs the session sends the user to sign in again.
  • Over the quota, the oldest session ends. A user signed in on many devices finds their oldest one signed out.

How a session, an app’s session and a refresh token end: an example

Section titled “How a session, an app’s session and a refresh token end: an example”

With the defaults (two hours, 30 idle minutes) and the realm’s default token lifetimes, Maya signs in at 09:00 and opens an app that signs her in with OpenID Connect:

TimeWhat happens
09:00Maya signs in. The realm’s session will end at 11:00 at the latest, or sooner after 30 minutes unused. The app gets an access token (5 minutes) and a refresh token.
09:05 to 09:40Maya works in the app, which refreshes its access token every few minutes. Those refreshes use the app’s refresh token, not the realm’s session, so they don’t keep the session from idling.
09:20Maya opens a second app. Its sign-in uses the realm’s session without asking her anything, which counts as use: the idle clock restarts.
09:5030 minutes without use: the realm’s session ends. The app’s access is online (no offline_access), so its refresh tokens stop working at the same moment, and the app is sent a back-channel logout if it asked for one.
09:52The app’s next refresh is refused. Its own session may still say Maya is signed in, but it has to send her to sign in again.

If users spend long stretches in apps without returning to the realm, raise maxIdleMinutes, or give those apps offline access. With offline_access, the refresh tokens outlive the session until their own lifetime ends (a day by default); see Choose online or offline access.

Setting or limitDefaultRange
maxSessionMinutes: how long a session lives120 (two hours)up to 43200 (30 days)
maxIdleMinutes: how long it may sit unused30up to 1440 (a day)
sessionQuota: sessions one user holds at once101 to 20
loginTimeoutSecs: the whole sign-in, however many pages1201 to 86400
pageTimeoutSecs: one page of a sign-in120

The last two are on authSettings, in Authentication → Settings.

SymptomCauseFix
A script’s calls start failing with 401Each run signs in again, and past the quota its oldest sessions, or the user’s, are endedSign in once per run and reuse the session
A user is signed out of one device when they sign in on anotherThey hold sessionQuota sessions alreadyRaise sessionQuota (up to 20), or have them sign out where they no longer work
A sign-in page says it has expiredThe user took longer than pageTimeoutSecs on a page, or loginTimeoutSecs overallStart again; raise the timeouts if users often need longer

Each sign-in is recorded step by step (LOGIN_STARTED, MODULE_COMPLETED, then LOGIN or LOGIN_FAILED), an upgrade as SESSION_UPGRADED, each session ended as LOGOUT (including one ended by the quota), and expired sessions swept as SESSIONS_REAPED. In the dashboard, open Audit → Authentication; see What is recorded.

  • A page that can’t be answered isn’t shown. If the sign-in timed out, or another request already moved it on, the client is told so rather than shown a page whose answer would be lost.
  • A success that created nothing isn’t reported. If the sign-in timed out at its last step, no session id is handed back.
  • Each module leaves its own audit row, and the final row carries the whole sign-in.
  • Scripts share the quota. A script that signs in on every call ends its own earlier sessions, and the user’s; sign in once per run.
WhereSettingWhat it does
sessionSettingsmaxSessionMinutes (120; at most 43200, 30 days)How long a session lives
sessionSettingsmaxIdleMinutes (30; at most 1440, a day)How long it may sit unused
sessionSettingssessionQuota (10; 1 to 20)How many sessions one user holds at once
oauth2SettingsacrValues, amrValuesWhich chain earns each acr, and which amr each module adds

Values in brackets are the defaults.