Documentation
Sessions
User-side session listing and revocation. Wraps /api/v1/auth/sessions.
For admin-side session listing across users, see sdk/HANDOFF.md post-launch backlog (P1 — not yet shipped).
Setup
The sessions client requires the authenticated user's requests.Session (Python) or session shim (TS).
from shark_auth import AuthClient, SessionsClient
auth = AuthClient("https://auth.example.com")
auth.login("alice@example.com", "...")
sessions = SessionsClient("https://auth.example.com", session=auth._session)
import { AuthClient, SessionsClient } from "@sharkauth/sdk";
const auth = new AuthClient("https://auth.example.com");
await auth.login("alice@example.com", "...");
const sessions = new SessionsClient("https://auth.example.com", { session: auth.session });
List
rows = sessions.list()
for s in rows:
print(s["id"], s.get("user_agent"), s.get("current"))
const rows = await sessions.list();
for (const s of rows) console.log(s.id, s.user_agent, s.current);
Each row carries id, created_at, last_used_at, user_agent, ip, current (boolean).
Revoke a single session
sessions.revoke("sess_abc")
await sessions.revoke("sess_abc");
Revoke all (except current)
The user-facing surface has no bulk-revoke endpoint. The SDK iterates list() and skips the row flagged current.
await sessions.revokeAll();
Consents
Sibling client for user-granted OAuth consents.
from shark_auth import ConsentsClient
consents = ConsentsClient("https://auth.example.com", session=auth._session)
consents.list()
consents.revoke("cnst_abc")
import { ConsentsClient } from "@sharkauth/sdk";
const consents = new ConsentsClient("https://auth.example.com", { session: auth.session });
await consents.list();
await consents.revoke("cnst_abc");
See also