Join our Newsletter — 33% off our NHI Course

When should teams use a browser logout flow versus a server-side revoke call to end an impersonation session?

Use browser logout when the impersonating admin is ending their own session from the UI, because that path clears local state and completes the sign-out through the browser. Use server-side revocation when a separate control plane, such as security operations, needs to terminate a live session. The revoke API requires a secret key, so it belongs on the backend, not in the client.

Why the choice depends on who is ending the session

An impersonation session can end in two very different ways: the current browser user can sign out of their own session, or an external control plane can terminate the session from the backend. That distinction matters because browser logout is a client-facing cleanup action, while revoke is a server-side authority action that should be reserved for trusted operational workflows.

Browser logout is the safer fit when the impersonating admin is done and wants the UI to clear local session state, cookies, and browser context. Server-side revocation is the better fit when the goal is to cut off a live session regardless of which browser or tab is still open, especially if security operations or another backend workflow needs to act decisively.

The practical rule is not “which is stronger,” but “which control plane owns the termination.” If the person ending the session is the same person who holds it, logout is usually enough. If a separate team needs to intervene, a revoke call is the right mechanism because it enforces termination at the server rather than relying on the browser to cooperate.

Why revoke belongs behind the backend

Server-side revocation is an authorization-sensitive action because it requires a secret key and can invalidate an active session remotely. That makes it unsuitable for client code, where the secret would be exposed and where an attacker could abuse the same capability to terminate or manipulate sessions.

This is also why revocation is conceptually different from ordinary sign-out. Sign-out is about ending the user’s current browser session. Revocation is about invalidating the authority that keeps the impersonation session alive, even if the browser is not the thing initiating the shutdown. When teams blur those two paths, they often place powerful session-control logic in the wrong place.

If your architecture includes a support desk, incident response, or security operations path that can forcibly end impersonation, that path should be treated like any other privileged backend action. The browser should not hold the credential that can revoke itself or other sessions.

How teams should decide which termination path to use

The right choice comes down to intent, reach, and trust boundary. Use browser logout when you only need to end the current interactive session in the same client that created it. Use server-side revoke when you need to guarantee termination across all active state, or when the termination request comes from a different operational system.

OWASP Non-Human Identity Top 10 is useful here because the same control problem shows up whenever long-lived credentials or session authority can outlive the user action that created them. For lifecycle and offboarding patterns, NHI Lifecycle Management Guide helps frame when a session should end locally versus when a backend control should forcibly retire it.

For teams standardising the implementation, the core design question is whether the termination must be immediate, centrally enforceable, and independent of the browser state. If yes, use revoke. If no, and the user is simply ending their own impersonation flow, logout is the simpler and more appropriate path.

Risk and Threat Considerations

Using the wrong end-of-session path can leave impersonation authority active longer than intended, or place a high-value secret in a place it should never be exposed. That creates session persistence risk, accidental overreach, and an avoidable blast radius if the browser or client environment is compromised.

Failure mechanism: Client-side logout only clears local state, while the server continues to recognise the impersonation session or its backing credential. If the revoke capability is exposed to the browser, the secret used to terminate sessions can be stolen or misused.

Impact: An attacker or unauthorised user can keep using an impersonation path after the UI appears signed out, or can abuse exposed revoke power to terminate valid sessions. In both cases, the trust boundary between user action and authoritative session control has been broken.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Non-Human Identity Top 10 addresses the attack surface, NIST SP 800-53 Rev 5 sets the technical controls, and ISO/IEC 27001:2022 defines the regulatory obligations.

Framework Control / Reference Relevance
OWASP Non-Human Identity Top 10 NHI-07 — Long-Lived Secrets Impersonation revocation depends on secret-backed session authority.
NHI-04 — Insecure Authentication Session termination is part of protecting authenticated impersonation flows.
Recommendation — Keep revocation secrets server-side and limit their lifetime. Ensure impersonation sessions can be ended through trusted server controls.
NIST SP 800-53 Rev 5 IA-5 — Authenticator Management Revocation and logout both depend on safe lifecycle handling of authenticators.
AC-6 — Least Privilege Revoke capability should be restricted to trusted backend operators or services.
IA-9 — Service Identification and Authentication Backend revocation is a service-to-service control requiring authenticated authority.
Recommendation — Enforce server-controlled issuance, rotation, and invalidation of session credentials. Limit session-termination authority to the smallest trusted control plane. Authenticate backend revocation calls before allowing session invalidation.
ISO/IEC 27001:2022 A.5.15 — Access control The choice separates user-facing sign-out from privileged session revocation.
A.8.5 — Secure authentication Impersonation sessions must be authenticated and ended through controlled mechanisms.
Recommendation — Define which roles may end sessions and through which control path. Protect session-authentication flows from client-side exposure and misuse.

Practitioner Guidance

What to verify: Confirm that browser logout only affects local session state and that server-side revocation is available only through a trusted backend path. The easiest test is whether the session still exists after the browser is closed, refreshed, or moved to another device.

Decision rule: If the action is user-initiated and limited to the current interactive session, use logout. If the action must cut off access centrally, or if another team needs to terminate the session on the user’s behalf, use revoke and keep the secret off the client.

Practitioner takeaway: Treat logout as a convenience path and revoke as an authority path. The more the termination must survive browser state, the more it belongs on the server.