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.
Before you begin
Section titled “Before you begin”- Who can do it: a realm administrator, in a group that holds
RealmOwner(Delegated administration).RealmViewercan list sessions but not end them. - Where: today this is done through the API (Call the API shows how to get
$CVYUH_SESSION).
How it works
Section titled “How it works”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:
| Field | What it is |
|---|---|
id | The session’s name, which you end it by. It is a digest of the session’s token, never the token |
sid | Its sign-in lineage, which an upgraded session keeps |
user | Whose session it is |
state | Whether it is live |
created, lastAccess | When it began, and when it was last used |
absoluteEnd, idleEnd | When it ends however it is used, and when it will end if left idle |
source | The 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).
Set it up
Section titled “Set it up”-
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 }, or404when 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 }.
What the user sees
Section titled “What the user sees”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.
Limits and defaults
Section titled “Limits and defaults”| Limit | Value |
|---|---|
| Sessions ended by one call | at most 10,000; call again for the rest |
| Sessions listed per page | the realm’s usual page size; ask for the next page |
Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause | Fix |
|---|---|---|
404 ending one session | It already ended, or the name is wrong | List the user’s sessions again |
400 ending several | Both names and qbe were sent, or neither | Send exactly one |
| The user is still in an app after their session ended | The app ignores back-channel logout and keeps its own session | Have the app register a back-channel logout address; see Tell other apps about a sign-out |
Audit record
Section titled “Audit record”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.
Good to know
Section titled “Good to know”- 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.
Related
Section titled “Related”- Sessions: how long sessions last, and how many one user holds.
- Tell other apps about a sign-out: what apps receive when a session ends.
- Revoke a token: revoke one token rather than a whole session.