Implementing single logout with Zitadel back-channel logout

Back-channel logout lets Zitadel notify each relying app server to end its session when a user signs out of one app. This page explains the flow, the design decisions and what to confirm in your Zitadel version.

On this page

How Zitadel back-channel logout ends sessions across apps

A user who signs out of one application expects the others to end their sessions too, and OIDC back-channel logout is the server-to-server mechanism for doing that. When a session ends at Zitadel, the identity provider sends a signed logout token to the back-channel logout endpoint that each relying application has registered, so the application can end its own session without depending on the user's browser. This matters most for multi-app workforces, where staff move between internal tools all day, and for customer and partner portals where one sign-in opens several connected services. Confirm in the Zitadel documentation for your version how sessions are linked to applications and which logout settings each application type exposes, because those settings determine what every client must handle.

The feature covers only part of the job. Each relying application must still track and end its own sessions, because Zitadel can notify an application but cannot clear that application's cookies or in-memory state. Your development team needs to decide how the application maps an incoming logout token to its local sessions, typically through the sid claim or the sub claim, and how it responds when a token names a session it never saw. Plan for a logout token that arrives when the user has no active session, and for one that arrives more than once. Validate the signature, issuer, audience and the events claim before acting on any token.

Two risks deserve attention before the build. Back-channel delivery is server to server, so a failed notification can leave a live session in one application even though the user signed out everywhere else. Confirm with Zitadel how it retries failed deliveries and what happens when an application is unreachable. Front-channel logout, which runs through the browser, can complement back-channel logout for applications that must clear browser state, but it depends on the browser staying available and on how it handles cookies. Test both paths with the browsers and identity provider settings your users run, and record the expected result for each application.

How a sign-out reaches every application

The sign-out starts in the browser when a user ends their session in App A. App A redirects the browser to Zitadel's end-session endpoint, and Zitadel then builds a logout token for each application that registered a back-channel logout URI for that session. Zitadel calls each application's back-channel endpoint from its own server, so the browser takes no part in that hand-off. Each application validates the token's signature, issuer and audience, reads the session identifier (sid), and ends its matching local sessions. Check that every relying party keys its sessions on the same sid.

Browser, Zitadel and app backends, linked by the logout token and sid.

Back-channel versus front-channel logout

Back-channel logout works without the browser. When a session ends at the identity provider, Zitadel sends a signed logout token directly from its server to a logout endpoint registered by each relying party. The application receives the token, identifies the sessions tied to the sid or sub claims, and invalidates them on its own side. Because the signal never depends on the user's browser, it reaches apps even when the user has closed the tab or moved on to another device.

  • Signal path: Zitadel calls each registered back-channel logout URI over HTTPS from the server, so the browser is not involved in delivery.
  • What the app must expose: A logout endpoint that accepts the logout token, validates its signature, issuer, audience and event claim, and records which sessions to end.
  • Session mapping: The app must store the sid or subject with each local session, so it can find and end the right sessions when the token arrives.
  • Failure modes: A delivery that fails or times out leaves the app session alive, so the app needs retry expectations and its own session lifetime limits.
  • Best fit: Server-rendered web apps, APIs with session state, and any app where the logout must take effect even without the browser.

Confirm the exact logout options and their configuration in the Zitadel documentation for your deployed version before you design the endpoints.

Which logout approach fits each application type

This table compares how each application type ends its local session during single logout, what state that type must track, and the main risk. Read each row as a starting point for design, then confirm the Zitadel behavior for your exact application setup before committing to it. The main takeaway is that back-channel logout only reaches applications that hold a server-side session the relying party can revoke.

Application typeLogout mechanism that fitsSession state to trackMain riskWhat to confirm
Server-side web app with a backendBack-channel logout endpoint receiving a logout tokenSession ID (sid) mapped to the local login sessionSessions stay open if the logout token is not validated or the sid mapping is missingLogout token validation steps and the events claim in the Zitadel docs
Single-page app in the browserFront-channel redirect to end_session plus local token clearingTokens in browser storage and the post-logout redirect URIBack-channel calls cannot reach the browser, so other tabs or apps may stay signed inPost-logout redirect URI settings and whether front-channel logout is supported
Native or mobile appSystem browser logout, then clearing tokens in secure storageRefresh tokens and the device-bound sessionRefresh tokens may survive if the app only deletes local copiesHow Zitadel revokes refresh tokens on logout and the redirect scheme rules
Backend API with an opaque access tokenToken revocation or introspection checks, not a logout endpointToken validity and cache lifetime at the APICached introspection results can accept a token after the user has signed outIntrospection caching behavior and the token lifetime settings
Backend API with a JWT access tokenNo session to end; rely on short token lifetimeAccess token expiry time and audienceA valid JWT stays usable until it expires unless the API checks other stateAccess token lifetime settings and whether revocation applies to JWTs
Background worker or service accountNot part of user logout; revoke its credentials separatelyService account keys and client credentialsConfusing user sign-out with machine access, leaving keys activeKey rotation and deactivation options for service accounts

How each app tracks sessions so logout takes effect

A back-channel logout token only helps if the receiving application can find and end the session it names. Zitadel sends a logout token to each registered back-channel logout URI, and that token carries the identifiers the app needs: the sub claim identifying the user and a session identifier claim, normally sid, identifying the specific login session. Each app must map that sid (and, as a fallback, the subject) to its own local session record. The app is responsible for that mapping, not Zitadel. Before building anything, confirm with a test sign-in exactly which identifier claims Zitadel includes in logout tokens for your chosen client configuration, and whether sid is present in the ID token the app stores. If the claim is missing from the ID token, the app has nothing to match against later.

Where the app keeps sessions determines how hard this mapping is. An app that holds sessions in process memory can only end sessions on the instance that received the request, so a logout that lands on another replica has no effect and the user stays signed in there. Apps that store sessions in a shared cache such as Redis or Memcached can delete the key directly, but only if the key is derived from the sid or an equivalent index is kept alongside it, because a cache keyed only by a session cookie value cannot be searched by identifier. Apps that store sessions in a relational database can delete rows by identifier, but only if the identifier column is indexed. Without an index, every logout becomes a full table scan, which slows under load and can delay the point where sessions actually end. Treat the index as a required part of the schema, and test it with realistic session volumes before go-live.

For each app, write down three things before development starts: the store type, the key or column that holds the sid, and the behavior when no matching session exists. A logout for an unknown session should succeed quietly, since the session may already have expired or been ended elsewhere, and it should not return an error that causes Zitadel to treat the delivery as failed. Also decide how long a mapping must survive. It should last at least as long as the longest session lifetime the app accepts, or the logout will arrive after the record is gone. Ask the security engineers to review these choices alongside the session lifetime policy, because a mismatch there is where single logout most often fails silently.

Setting up back-channel logout for each client

This sequence takes each relying application from its current logout behavior to one where a single sign-out in Zitadel reaches every connected app's backend and ends its local session. Each step closes with a check, so the team knows the logout path works before it is relied on.

  1. Confirm the self-hosted Zitadel and logout endpoints

    The platform team confirms that the self-hosted Zitadel instance is reachable at the public issuer URL that every client will validate against, and that the instance and its PostgreSQL database are healthy. The application team confirms that its backend exposes a dedicated endpoint that can accept an HTTP POST from Zitadel, and that the endpoint is reachable from Zitadel's network path, not only from browsers. Write the issuer, endpoint path and network route into a short inventory per application. The step is done when both teams can name the issuer, the endpoint and the route for every client in scope. Confirm the supported PostgreSQL versions and deployment method against the Zitadel database and self-hosting documentation before you start.

  2. Register logout URIs on each client

    On each OIDC application in Zitadel, the administrator registers the back-channel logout URI that points to the app's backend endpoint, along with any post-logout redirect URIs the app needs after the user signs out. Use exact URIs with the correct scheme and host, because mismatched values are a common cause of logout that silently does nothing. Confirm in the Zitadel console or API that the stored values match the inventory from the previous step. The step is done when a configuration review lists, for every client, the back-channel URI and post-logout URIs with no wildcard or placeholder values. Check the current configuration options against the Zitadel documentation for the version you run, since field names and screens can change between releases.

  3. Implement logout token validation in each backend

    Each application's backend developer adds a handler for the back-channel request that validates the logout token before taking any action. The checks are the signature against the keys published at Zitadel's JWKS endpoint, the issuer, the audience set to the client's own client ID, the presence of the back-channel logout event claim, and the absence of a nonce claim. The handler should reject invalid tokens with an error status and must not end any session on a token that failed validation. Use the library your framework already trusts for JWT verification, and cache the signing keys with a refresh path for rotated keys. The step is done when unit tests cover each rejection case and the handler accepts only tokens that pass every check.

  4. Map the session identifier to local sessions

    Each application must know which local sessions belong to a given Zitadel login so that a logout token can end the right ones. The developer records the session identifier (sid) and subject (sub) from the ID token at sign-in, stores them with the local session, and builds an index that finds sessions by sid, and by sub when a logout token carries only the subject. The handler then revokes matching sessions in the application's own store and clears any cached tokens tied to them. Decide and document whether a logout event for a subject should end all sessions for that user or only the one matching sid. The step is done when a test creates two sessions for one user, sends a logout token for one sid, and confirms that only the matching session is revoked.

  5. Test a logged signature failure

    Before the full test, the security or QA team sends a logout request with a tampered or wrongly signed logout token to each backend. The expected result is a rejection response, a log entry that records the failed validation, and no change to any session. Repeat the test with a token that has the wrong audience, a wrong issuer and a missing event claim, so each rejection path is exercised. Confirm that the log entries contain enough detail to investigate without exposing the token contents. The step is done when every negative case returns a rejection, leaves sessions intact and produces a log record the security team can find.

  6. Test one sign-out across two signed-in apps

    The tester signs in to two registered applications with the same Zitadel user in one browser session, confirming that both have active local sessions. The tester then signs out from one application through Zitadel, and watches Zitadel send a logout token to the backend of the other application. The check is that the second application's local session ends and that a subsequent request to it requires a new sign-in. Repeat the test with the sign-out started from the second application to confirm the reverse path. Record the timing of each logout event in the logs so that any delay is visible. The step is done when both directions end both sessions in the test run.

  7. Confirm session end and review front-channel behavior

    Finally, the tester checks each application's session store and browser behavior to confirm that every app is signed out, not only the app where sign-out started. Front-channel redirects still return the user to the post-logout URI, and they remain a browser-dependent step that depends on third-party cookies and user agent settings, so do not treat them as the reliable way to end sessions in other apps. Document which apps rely on front-channel logout as a fallback and which depend only on back-channel delivery. The step is done when a signed record shows a confirmed session end in every app in the test, and the team has agreed on the fallback behavior for each client.

What front-channel redirects still do

Front-channel redirects still have a job in single logout. When a user signs out of an application, that application sends the browser to Zitadel's end-session endpoint, and Zitadel returns the browser to the post-logout redirect URI registered for that application. The redirect also clears the browser-side session of the app that started the sign-out. Those steps happen in the user's browser, so they are the only part of the flow the user's own session can carry. For single-page apps and other clients that cannot accept server-to-server calls, the redirect may be the only logout path you can offer, so plan for it explicitly rather than treating it as a leftover.

Relying on redirects alone leaves gaps. Browsers increasingly restrict third-party cookies and storage, so an iframe or redirect that depends on cross-site state may fail silently, and the other applications' sessions may survive. Redirects also depend on the browser still being open and the network path being healthy. If an application has already closed, or the tab was killed, no redirect runs at all, and any app that only listens for front-channel signals will keep a live session. This is why back-channel calls to each application's logout endpoint should carry the cross-app logout, with the redirect serving as the user-visible confirmation.

Before you rely on this design, confirm the exact redirect parameters, the rules for registering post-logout redirect URIs, and how Zitadel matches them in the Zitadel documentation for logout and application settings. Test a registered URI, an unregistered URI and a URI that differs only in path or trailing slash, and record what Zitadel returns for each. Your test plan should also cover a browser with third-party storage blocked and a sign-out started from an application whose tab was closed before the redirect completed.

Security risks in logout token handling

Back-channel logout moves session termination from the browser to server-to-server calls, so each relying party must verify who is calling and what it is asking to end. The cards below cover the failure modes that most often leave sessions alive or let a forged request end someone else's session.

Unverified logout tokens

A logout endpoint that accepts any POST with a logout_token parameter can be driven by anyone who knows its URL. Validate the token signature against the Zitadel signing keys published in the JWKS, confirm the iss claim matches your instance, and confirm the aud claim contains your client ID. Test with a token signed by an unrelated key and with a token issued for a different client, and confirm both are rejected.

Zitadel APIs

Replayed logout tokens

A captured logout token that is accepted twice can end sessions the user has since restarted. Check that the token carries the jti and events claims required by the specification, record recently seen jti values for their validity window, and reject repeats. Confirm that the session end applies only to sessions created before the token's iat time.

Logout endpoints reachable without restriction

A back-channel endpoint exposed to the public internet widens the attack surface even when token checks exist. Limit the route at the gateway or ingress to POST requests from the Zitadel network path where possible, apply rate limits, and keep the endpoint off any path that serves user-facing pages. Test by calling it from an unapproved network and by sending GET requests.

Session identifiers in logs

Logout tokens carry the session identifier and subject, and writing the full token to application or proxy logs turns a log reader into a session-termination tool. Log the event type, the outcome and a hashed or truncated session reference instead. Review access logs, error traces and APM spans for the logout route, and confirm that log shipping rules do not capture request bodies.

Caching that ignores logout

Apps that cache authorization decisions, user profiles or session lookups can keep serving a user after the logout event has arrived. Define a maximum cache lifetime for each session-derived value, invalidate entries when a logout for that session is processed, and test by signing out in one app and checking whether a cached page or API response is still returned in another.

Refresh and API tokens left active

Ending the browser session does not automatically stop a refresh token or an opaque access token from working in an app's own backend. Map each logout to the refresh tokens and access tokens issued for that session, revoke them where the token type allows, and shorten access token lifetimes so any leftover token expires quickly. Verify by using a refresh token after logout and expecting an error.

What teams ask before implementing Zitadel single logout

How much effort does Zitadel single logout implementation take?

No duration is supplied for this work, so treat any timeline as a question to answer during scoping. Effort rises with the number of applications that must end their sessions, the languages and frameworks they use, and how many session stores sit behind them. Each application needs a back-channel logout endpoint, a way to map the sid or subject in a logout token to local sessions, and tests that prove the session is actually gone. Multi-tenant setups, where one user spans several Zitadel organizations or projects, add more mapping and test cases. Ask for the effort breakdown per application in any quote.

Can our own team implement Zitadel single logout without a partner?

Yes, if your engineers have OpenID Connect experience and can change each application's session handling. The Zitadel side is mostly configuration: enabling back-channel logout on each client and registering the logout URI. The harder part is in each application, where session records must be found and invalidated from a logout token and tested under load and failure. Teams that lack a Zitadel administrator or app owners for every system often find the coordination cost is higher than the code. A partner can take the cross-application design and testing, while your team keeps ownership of the application code.

What do we need to provide for the implementation work?

Plan for four inputs before work starts. First, an owner for each application who can approve changes to its session handling. Second, a staging environment where each app and a self-hosted Zitadel instance run together, with logout URIs that match production patterns. Third, test accounts with known roles in each organization, including accounts that have active sessions in several apps at once. Fourth, a Zitadel administrator who can create clients, adjust logout settings and read the relevant logs. Missing any of these usually delays testing more than building.

What is one-time work and what recurs after single logout goes live?

The initial design, per-application endpoint and session work, and cross-app test suite are one-time costs. Recurring work includes updating the logout handling when an application or its framework is upgraded, reviewing logs for failed logout deliveries, and re-running the logout tests after each Zitadel upgrade. If you run Zitadel yourself, its database and platform upkeep are ongoing whether or not logout changes. Ask any provider to separate one-time build charges from any retainer for upgrades, monitoring and continuous testing, which DeployOpen offers as a retainer.

Is a fixed-scope engagement possible for Zitadel single logout?

Yes. Most DeployOpen engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts. For logout, a useful written scope lists the applications included, the languages and session stores in each, the Zitadel instance and organizations involved, the test cases that define done, and what is excluded, such as front-channel behavior in legacy apps. Changes to the scope after signing are handled through a written change. The quote then follows from that scope rather than from a list price.

What should we confirm before asking for a quote?

Confirm the Zitadel version and deployment model, since self-hosted Zitadel uses PostgreSQL with supported versions 14 through 18 and you should check the release you run against the release notes. Confirm the full list of relying applications, their frameworks, and whether each keeps server-side sessions. Confirm which applications must log out immediately and which can tolerate a delay, and whether any apps are third-party products you cannot change. Finally, confirm the test environments and who signs off on the logout behavior. Those answers let a provider give a quote that matches your environment.

Does single logout guarantee that every session ends everywhere?

No implementation can promise that, and you should not accept a guarantee from anyone. Back-channel logout depends on each application receiving and processing the logout token, and on the browser sessions and any cached tokens in each app being cleared. Applications that are offline, misconfigured or that keep their own long-lived sessions may remain signed in. Scope should state what is tested, how failures are logged and how a user is still protected, for example through short token lifetimes and access revocation, rather than promising a universal sign-out.

How DeployOpen works on this

DeployOpen plans and builds back-channel logout for your Zitadel and applications inside your own infrastructure, starting from an inventory of which apps share a session. The work is agreed in writing before it starts, then tested, documented and handed to your team with the operating runbook.

How we scope

  • Inventory every relying application, its OIDC client settings and whether it keeps its own local session.
  • Agree in writing which apps receive back-channel logout tokens and which only need front-channel redirects.
  • Define the logout trigger paths, such as user sign-out, admin revocation and session expiry, and the expected end state for each.

How we build

  • Configure the logout URI on each Zitadel application and the matching logout token validation in each app.
  • Implement per-app session tracking keyed to the session ID claim so logout tokens end the correct local sessions.
  • Test logout tokens with a reproducible set of sign-out scenarios, including apps that are offline when the token is sent.

How we hand over

  • Deliver a written document covering endpoints, claims checked, session mapping and known gaps for each application.
  • Walk your engineers through the logout test cases so they can rerun them after future changes.
  • Record configuration changes in the project's repository so your team can review and roll them back.

How we support

  • Offer ongoing support and upgrades for Zitadel and the integrated applications as a retainer.
  • Retest logout behavior after Zitadel upgrades or when a new application joins the single sign-on setup.
  • Confirm with your team which support hours and response expectations apply before the retainer starts.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.