Exit impersonation and restore original admin session
Verify the supplied original-admin token (captured at impersonation start) and return it so the client can restore the admin session. Only callable from a session whose token carries the isImpersonation flag.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Original admin JWT captured at impersonation start; re-verified server-side and must resolve to a SUPERADMIN/ADMIN role matching originalAdminUser.
Original admin payload (id, email, …) captured at impersonation start. Its id/email must match the verified originalAdminToken payload — guards against tampering.
Response
Impersonation exited
Returned by /api/auth/exit-impersonation after the original admin session is restored.
Original-admin access token to swap back into.
Compact User payload returned with auth tokens.
{
"id": "5f7b1c2e8a1d4e0012c3b4a5",
"email": "admin@acme.example",
"fullName": "Acme Admin",
"organizationId": "64a1b2c3d4e5f60012345678",
"accessRole": "ADMIN",
"conversationOpenPreference": "split"
}