Manage Sessions
A session records that a user signed in. A sign-in through a flow with Single Sign-On (SSO) enabled records an SSO session, which other applications on that flow can reuse. A sign-in through a flow without SSO records a direct session of its own, unless direct sessions are turned off. View the active sessions of a user or an application, and revoke any one of them, or every session of a user. The API marks each session with its type, SSO or DIRECT.
For how sessions and SSO work, see Sessions and Single Sign-On.
Prerequisites
- ThunderID running locally. See Get ThunderID.
- A user who has signed in to an application. A sign-in without SSO records a session only while direct sessions are on, which they are by default. See Sign-Ins Without SSO.
- The
org:session:viewpermission, which reaches the organization unit you hold it in, or thesystempermission, which reaches every organization unit. Revoking also needsorg:session:delete, unless you holdsystem. See System Permissions.
View Sessions
- Console
- API
Sessions are kept where users sign in. So the Sessions tabs are in the Console of a standalone ThunderID server, and in the Admin Console of a server that a Control Plane manages. The Control Plane console has no Sessions tabs.
- Navigate to Users in the Console and open the user.
- Open the Sessions tab.
Each session shows the browser and operating system it was created from and when it was last active. Click a session to see its IP address, its participants, when the user signed in, and when it expires. Participants lists the applications and agents that joined the session. Each shows its logo, or the application or agent icon when it has none. Its tooltip gives its name and says whether it is an application or an agent, and one that cannot be found shows only its ID.
To see the sessions that signed in to an application, open the application from Applications and open its Sessions tab. Each session there also names its user. The Admin Console has no Applications page, so use the API there. Agents have no Sessions tab, so use the API to see the sessions an agent joined.
Without the org:session:view or system permission, the Sessions tab says you don't have permission to view the sessions.
Call GET /sessions?userId=<user-id> for a user's sessions, or GET /sessions?appId=<application-or-agent-id> for the sessions an application or an agent joined. Exactly one of the two is required. See the Sessions API Reference for paging and the response fields.
Each session lists the applications and agents that joined it as participants, and each participant's type says which it is, app or agent. For an agent, appName is the value of its agent type's display attribute, or the agent ID when the type has none, and appLogoUrl is the agent's logo. The type, appName, and appLogoUrl fields are left out when they cannot be resolved, such as for a participant that no longer exists.
Revoke Sessions
Revoke a session to end it and revoke its applications' grants. ThunderID revokes each application's latest grant in the session. When token revocation is on (oauth.token_revocation.enabled, the default), it then refuses the refresh and access tokens from that grant; with it off, they stay valid until they expire or you turn it back on. The next sign-in to those applications asks for credentials again, and ThunderID sends a logout token in the background to each application that registered a back-channel logout URI. Delivery can fail, and the response says only whether it was queued. See Back-Channel Logout.
Call DELETE /sessions/<session-id> to revoke one session, or DELETE /sessions?userId=<user-id> to revoke every session of a user. Both return 200 with the revoked sessions, or 204 when they revoke none. For each application in them, the response reports whether its tokens are now refused (credentials) and whether it was asked to sign the user out (notification and channel). Revoking one session that is already gone or expired, or that has no application or agent signed in under your organization unit, revokes nothing. Revoking a user's sessions leaves such sessions out of the response. See the Sessions API Reference for the values.
Organization Units
One session can hold applications from more than one organization unit. For example, a user who switches organization in an application shared between two units stays in the same session, and the application appears once for each unit, with its ouId.
With org:session:view, you see only the sessions with an application or an agent signed in under your organization unit, and only those applications and agents. With org:session:delete, you revoke only those sessions, but each one ends as a whole, so its applications and agents in other organization units lose their access too. See System Permissions.
Let Users Manage Their Own Sessions
Signed-in users can list their own sessions with GET /users/me/sessions, using only their own access token. Each session has isCurrent, which is true for the session that issued the access token, and the listing leaves out userDisplayName. It shows only the sessions, applications, and agents of the organization unit the user signed in under. An access token from a sign-in without SSO finds its direct session the same way. A token from a sign-in that recorded no session, for example with direct sessions turned off, lists no sessions.
Users revoke one of those sessions with DELETE /users/me/sessions/<session-id>, or all of them with DELETE /users/me/sessions. Add excludeCurrent=true to keep the session that issued the access token, so the user stays signed in. The response lists the revoked sessions as the user's own listing shows them. When nothing is revoked, for example for a session the listing doesn't show, such as another user's, it returns 204. A delegated token, issued to a client acting for the user, cannot revoke the user's sessions. See the Sessions API Reference.