Skip to content
rw3iss Auth

SessionsList

form @rw3iss/auth-client/preact/forms/SessionsList framework-adapters/preact/components/forms/SessionsList.tsx ↗

Active sessions for either the caller or a target user.

Two modes, picked by the userId prop:

  • Self-service (default, userId omitted) — calls getSessions() + terminateSession(). Lists the caller’s own sessions; the row backing the current call is tagged is_current and rendered with a “this device” pill. Terminating the current row triggers the SDK’s logout-on-401 path automatically.

  • Admin (userId set) — calls adminListUserSessions() + 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_current is 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

NameTypeDescription
clientAuthClient
userIdstringWhen 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) => stringCustom row formatter — override to render brand colors per browser, etc.
classNamestring