Active Sessions & Instant Revocation
Track active devices, inspect client IPs, and execute instant remote signouts across web, mobile, and API clients.
Dual-layer session architecture
Stateless JWT tokens present a well-known security challenge: once signed, a JWT cannot be invalidated until its expiration timestamp without a revocation mechanism. If an end-user loses their laptop or their token is compromised, waiting 15 to 60 minutes for token expiration is an unacceptable security window.
HVT solves this with a dual-layer session architecture:
- Persistent Database Layer: Every authentication event creates a
UserSessionrecord in PostgreSQL. This stores client IP addresses, parsed device names (e.g. "Chrome on macOS", "Safari on iPhone"), User-Agent headers, creation dates, and throttled last-active timestamps. - Sub-Millisecond Redis Cache Layer: Active sessions are registered in Redis under
session:active:<sid>. When a session is revoked, HVT immediately deletes the active key and writes tosession:revoked:<sid>with a 7-day TTL matching refresh token lifetimes.
How tokens link to active sessions
Whenever HVT issues an access token or refresh token, it embeds the active session UUID inside the sid (Session ID) claim:
This claim connects stateless cryptographic verification to the live session registry, allowing applications to verify signatures locally while retaining instant revocation capabilities.
Session management API endpoints
HVT exposes dedicated endpoints for both end-users (runtime plane) and organization administrators (control plane):
| Method & Path | Description | Scope |
|---|---|---|
GET /api/v1/auth/runtime/sessions/ | List active sessions and devices for the calling runtime user. | End-User |
DELETE /api/v1/auth/runtime/sessions/<id>/ | Instantly revoke a specific session by UUID. | End-User |
POST /api/v1/auth/runtime/sessions/revoke-all/ | Revoke all sessions except the current caller ("Log out everywhere else"). | End-User |
GET /api/v1/auth/sessions/ | Control-plane equivalent for organization team members and developers. | Platform User |
Listing active sessions returns device metadata and highlights the current caller:
Revoking a specific remote device:
Executing global remote logout across all other devices:
Hybrid verification pattern
For maximum performance, downstream services verify RS256 token signatures locally via JWKS on every request. To enforce instant revocation, services can perform an ultra-fast Redis check against session:revoked:<sid>:
Frontend device manager component
A ready-to-use React component for user account settings, displaying active sessions and providing one-click revocation: