Skip to content
Workforce IdentityMarkdown

Session management

See who is signed in to your realm, and end one session, a user's every session, or every session that matches a search, each as a sign-out.

AvailableAPI

A realm administrator can see every live session in the realm and end any of them. End one user’s sessions when their laptop is stolen, everyone’s from an address you no longer trust, or a single session that looks wrong. Ending a session here is the same as the user signing out: the apps they signed in to are told, and what was issued under the session stops working.

  • Who can do it: a realm administrator, in a group that holds RealmOwner (Delegated administration). RealmViewer can list sessions but not end them.
  • Where: today this is done through the API (Call the API shows how to get $CVYUH_SESSION).

GET https://foobar.cvyuh.com/api/v0/am/sessions/v1 (Call the API shows how to get a session) lists the realm’s live sessions, a page at a time. Each one shows:

FieldWhat it is
idThe session’s name, which you end it by. It is a digest of the session’s token, never the token
sidIts sign-in lineage, which an upgraded session keeps
userWhose session it is
stateWhether it is live
created, lastAccessWhen it began, and when it was last used
absoluteEnd, idleEndWhen it ends however it is used, and when it will end if left idle
sourceThe address it signed in from

To narrow the list, send a filter: the same search the realm’s other lists take. To see one user’s sessions:

filter={"filter":{"field":"user","op":"=","value":"<user id>"}}

Ending a session is a sign-out. The session ends at once, everywhere, and every app that signed in through it gets a back-channel logout (see Logout). Tokens issued under it are revoked with it, and the end is sent as session-revoked to anyone following the user through shared signals (see Send signals).

  • End one session:

    Terminal window
    curl -X DELETE 'https://foobar.cvyuh.com/api/v0/am/sessions/v1/<id>' \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION"

    The realm answers { "ended": 1 }, or 404 when that session isn’t live.

  • End several sessions, by their names, across any users:

    Terminal window
    curl https://foobar.cvyuh.com/api/v0/am/sessions/v1/end \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -d '{ "names": ["<id>", "<id>"] }'
  • End every session a search matches, such as all of one user’s:

    Terminal window
    curl https://foobar.cvyuh.com/api/v0/am/sessions/v1/end \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -d '{ "qbe": { "filter": { "field": "user", "op": "=", "value": "<user id>" } } }'

Send names or qbe, never both. The realm answers with how many live sessions it ended: { "ended": 3 }.

The user is signed out. Their next request to the realm asks them to sign in again, and an app that receives the back-channel logout ends its own session. An app that doesn’t listen for logouts finds out at its next refresh, which is refused; until then, an access token it already holds works until it expires (5 minutes by default) at an API that doesn’t check revocation.

LimitValue
Sessions ended by one callat most 10,000; call again for the rest
Sessions listed per pagethe realm’s usual page size; ask for the next page
SymptomCauseFix
404 ending one sessionIt already ended, or the name is wrongList the user’s sessions again
400 ending severalBoth names and qbe were sent, or neitherSend exactly one
The user is still in an app after their session endedThe app ignores back-channel logout and keeps its own sessionHave the app register a back-channel logout address; see Tell other apps about a sign-out

Each session ended is recorded as LOGOUT on the user’s trail, with you as the actor. In the dashboard, open Audit → Authentication; see What is recorded.

  • It needs permission on the realm’s sessions. Listing needs read access, and ending needs modify access, on the realm’s sessions or the one session named. A realm administrator holds both.
  • Cutting someone off takes more than their sessions. Offline access and agents outlive a session; see Cut a user off now.
  • Users end their own sessions by signing out. A sign-out from an app ends the session the same way; see Sign users out from an app.