SessionsList
Active sessions for either the caller or a target user.
Two modes, picked by the userId prop:
-
Self-service (default,
userIdomitted) — callsgetSessions()+terminateSession(). Lists the caller’s own sessions; the row backing the current call is taggedis_currentand rendered with a “this device” pill. Terminating the current row triggers the SDK’s logout-on-401 path automatically. -
Admin (
userIdset) — callsadminListUserSessions()+adminTerminateUserSession(). Surfaces another user’s sessions for support / IR / kicking someone out of their other laptop. Caller must hold a system_admin or super_admin token; the server enforces.is_currentis never set in this mode (meaningless when the caller isn’t the session’s owner).
Same renderer, same row markup — only the data source switches.
If you want to render admin vs self-service differently, wrap
<SessionsList> and override formatDevice.
Usage
import { SessionsList } from '@rw3iss/auth-client/preact/forms';
<SessionsList />Props
| Name | Type | Description |
|---|---|---|
client | AuthClient | |
userId | string | When set, the component lists & terminates sessions for the given user via the admin endpoints rather than the caller’s own. Requires admin role server-side. / |
formatDevice | (s: SessionRecord) => string | Custom row formatter — override to render brand colors per browser, etc. |
className | string |