Admin Impersonate Mode
Impersonate Mode lets enterprise admins view the Mnemom dashboard from a customer’s perspective. This is essential for diagnosing issues, verifying what a customer sees, and providing support — without ever modifying their data.How It Works
Start a Session
An admin clicks View as Customer from the customer detail panel, or calls
POST /v1/admin/users/:userId/impersonate. The backend creates a session record and returns a short-lived opaque token.View as Customer
The frontend stores the token and includes it as an
X-Impersonate-Token header on all API calls. The backend resolves the target user’s data instead of the admin’s — agents, billing, org context, everything.Read-Only Enforcement
All write operations (POST, PUT, PATCH, DELETE) to non-admin endpoints are rejected with a
403 while the token is active. This is enforced server-side, not just in the UI.Security Model
| Property | Detail |
|---|---|
| Auth | Admin’s own Supabase JWT remains the auth credential — no JWT forgery |
| Token | Opaque 32-byte hex, SHA-256 hashed before storage |
| Expiry | 1 hour, enforced server-side |
| No nesting | Cannot impersonate another admin |
| Read-only | Centralized write guard rejects all mutations during active session |
| Storage | sessionStorage — clears on tab close |
| API keys | Already masked (key_prefix only) |
| Payment details | Stripe never returns full card numbers |
Audit Trail
Every impersonation session generates:- An
impersonate_userentry inadmin_audit_logat session start - Per-page visit records in
admin_impersonation_page_visits - An
impersonation_endentry inadmin_audit_logat session end
API Endpoints
Start Impersonation
Get Session Status
410 Gone if expired/ended.
End Impersonation
RBAC
Only users withapp_metadata.is_admin === true can start impersonation sessions. The admin guard is the same one used for all admin endpoints.