Auth

Exit impersonation and restore original admin session

POST
/api/auth/exit-impersonation

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.

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "https://example.com/api/auth/exit-impersonation" \  -H "Content-Type: application/json" \  -d '{    "originalAdminToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI1Zjdi...",    "originalAdminUser": {      "id": "5f7b1c2e8a1d4e0012c3b4a5",      "email": "admin@acme.example",      "fullName": "Acme Admin",      "organizationId": "5f7b1c2e8a1d4e0012c3b4a5",      "accessRole": "ADMIN"    }  }'
{  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",  "user": {    "id": "5f7b1c2e8a1d4e0012c3b4a5",    "email": "admin@acme.example",    "organizationId": "64a1b2c3d4e5f60012345678",    "accessRole": "ADMIN"  },  "message": "Impersonation exited successfully"}