Zitadel token exchange for impersonation and delegation

Zitadel token exchange under RFC 8693 lets a trusted service swap a token for a different audience, scope or subject. This page covers when that fits, the token type trade-offs and the permissions to keep tight.

On this page

When Zitadel token exchange for impersonation and delegation fits

Token exchange fits when a support tool, backend service or downstream API needs a token for a different audience, scope or user than the one it was issued. Zitadel implements RFC 8693 to exchange a token for one with a different scope, audience or subject, so the question is less whether the platform can do it and more whether the business need justifies a pattern that lets one party act as another. Impersonation means a privileged caller obtains a token that represents an end user so it can see what that user sees. Delegation means a service obtains a token that carries both its own identity and the user's authority, so downstream systems can record who acted and on whose behalf. Use the first only for supervised support workflows and the second for service-to-service calls where the user's consent or context must travel with the request.

Two facts shape the design before you build. First, requested access tokens are opaque unless the JWT token type is requested, so the downstream API must be able to introspect or otherwise validate an opaque token, or you must ask for the JWT type and validate its signature and claims. Second, refresh tokens cannot be sent in the exchange, so the caller cannot use a long-lived refresh token to mint new exchanged tokens. Each exchanged token has to come from a subject token the caller already holds. Confirm both behaviors against the Zitadel token exchange guide in your target version, and test them in a non-production instance with your real resource servers.

If neither pattern is needed, a standard authorization code flow with a narrowly scoped client, or a service account with its own grants, is usually easier to audit. Pick token exchange only when a downstream system must see the user's identity or a different audience and cannot be redesigned to accept the caller's own token. Write down who may impersonate, which subjects are allowed, which audiences are reachable and how each exchange is logged before any client is configured.

Token types and result formats, and when each fits

This table compares the result formats Zitadel token exchange can return, opaque access tokens and JWT access tokens, and what each means for introspection, downstream validation and logging. Read each row against the services that will receive the exchanged token. The main takeaway is that the requested format is a design decision that changes where validation happens.

AspectOpaque access token (default)JWT access token (requested)
How it is requestedDefault result when the JWT token type is not requested in the exchangeRequested by including the JWT token type in the token exchange request
Validation downstreamReceiving services usually call the introspection endpoint to check the token and read its claimsReceiving services can validate the signature locally against published signing keys, if they have a JWT validation library
Introspection loadEach protected request may add a call to Zitadel, so confirm expected traffic and caching before go-liveIntrospection is needed less often, but confirm how revocation and expiry are handled in your design
Claims visibilityClaims are read through introspection, so the token itself reveals little to intermediariesClaims such as audience and subject are readable by anyone holding the token, so keep sensitive data out of it
Logging exposureLogged tokens reveal less content, which lowers the impact of a leaked log lineLogged tokens expose claims directly, so redact or truncate them in gateways and application logs
Refresh tokensRefresh tokens cannot be sent in the exchange, so plan for a new exchange when the token expiresSame restriction applies, so the format does not change how long-lived sessions are handled
Best fitServices under your control that can call introspection and want tokens revealing little if loggedHigh-volume internal APIs that validate tokens locally and have tested key rotation and revocation handling

How to set up token exchange in a self-hosted Zitadel

This sequence takes a self-hosted Zitadel instance from a confirmed project and exchange client to tested impersonation and delegation tokens, with a check at each step so a misconfiguration is caught before it reaches an application. It gives the team a repeatable path from configuration to verified behavior.

  1. Confirm the instance, organization and project

    The platform engineer confirms which Zitadel instance and organization will hold the exchange setup, and which project groups the target application, its roles and its grants. Keep the exchange configuration in the same instance and project that issue the subject tokens, because a token exchange cannot reach across instance boundaries. Done when you can name the instance, organization and project in writing and each one matches the environment that will use the tokens.

  2. Define the client that performs the exchange

    The identity administrator creates or selects the application that calls the token endpoint to perform the exchange, and records its client type and authentication method. Limit this client to the grant and token types the use case needs, and treat its credentials as privileged. Done when the client exists, its credentials are stored in your secrets system, and a test request reaches the token endpoint with valid client authentication.

  3. Define the target audience and roles

    The security architect lists which resource audiences the exchanged token may address and which roles or grants each audience requires for impersonation or delegation. Give each use case its own narrow role set rather than reusing a broad administrative role. Done when the list of audiences, roles and the users or service accounts allowed to receive them is approved and matches the grants configured in the project.

  4. Configure the requested token type

    The platform engineer sets the token type the exchange should return, choosing between the opaque access token that Zitadel issues by default and a JWT when the receiving service must validate claims locally. Confirm the choice against how the resource server validates tokens, since an opaque result needs introspection. Done when a test exchange returns the token type you chose and the receiving service accepts it.

  5. Test the impersonation case

    The QA engineer runs an exchange in which the exchange client acts on behalf of a named subject for a target audience, using a test user in a non-production organization. Check that the returned token carries the intended subject, audience and scope, and that a user without the required grant is refused. Done when both the permitted and refused cases behave as designed and the results are recorded with the request details.

  6. Test the delegation case

    The QA engineer runs a delegation exchange in which a token for one party is narrowed to a smaller scope or different audience for a downstream service, then confirms the downstream service honors only that narrower scope. Verify that refresh tokens are not included in the exchange request, since Zitadel does not accept them there. Done when the delegated token grants only the reduced scope and the rejected requests are logged as expected.

  7. Review the permissions and record the configuration

    The identity administrator reviews every client, role and grant from the earlier steps, removes anything the test cases did not need, and records the final configuration in version control or your change system. Confirm that the exchange client cannot reach audiences outside the approved list. Done when the reviewed configuration is signed off and the exact console and API paths used are documented in the guide at Zitadel docs: token exchange.

How a delegated token moves between client, Zitadel and the target API

The diagram starts with a calling service that holds a subject token for a user and sends it to the Zitadel token endpoint with a token exchange request. Zitadel checks the request and returns an exchanged token with a new audience or scope, which the calling service presents to the target API. The trust boundary sits between the calling service and the target, so check that the exchanged token is the only credential that crosses it, and that the requested scope is no wider than the target needs. Refresh tokens cannot be sent in the exchange.

Subject token exchanged at Zitadel before reaching the target API.

Permissions to keep tight during impersonation and delegation

Token exchange lets a client trade one token for another with a different audience, scope or subject, so it widens the blast radius of any client or operator who can call it. The cards below cover the controls to decide and verify before exchange reaches production, and each one should be confirmed in your own Zitadel environment against the current documentation.

Which clients may exchange tokens

Decide which applications are allowed to call the token exchange endpoint at all. Most clients never need it, so the default should be no exchange for them. Check that the client configuration for each application matches that decision, and that no shared or legacy client has been granted the ability by accident. Confirm the exact client settings in your Zitadel version, because the control surface changes between releases.

Token exchange docs

Which subjects may be impersonated

Impersonation should be limited to named, justified cases such as support sessions on a specific user. Define which user populations can be impersonated (for example, end users but never other administrators) and who may request it. Review this list as a policy document, not only as a configuration value, so that the boundary is visible to auditors and support leads.

Audience and scope limits

A token exchange can narrow or change the audience and scope of a token, but it can also request broader access than the original client needed. Keep requested audiences to the APIs that the exchanging workflow actually calls, and keep scopes to the minimum. Test that a request for an unlisted audience or scope is refused, rather than assuming the boundary holds.

Token lifetimes for exchanged tokens

Exchanged tokens should live no longer than the task that needs them. Confirm the access token lifetime that applies to exchanged results in your instance, and set shorter lifetimes for impersonation than for normal sign-in where your policy requires it. Refresh tokens cannot be sent in an exchange, so a long-running delegated task must re-run the exchange rather than extend a stored token.

Audit logging of exchanges

Every exchange, especially impersonation, should leave a record that ties the acting party, the subject and the requested audience together. Confirm which events Zitadel records for token exchange requests in your version, where they are stored, and how long they are retained. Forward them to your SIEM and test that an investigator can reconstruct a support session from them.

Separating administrator and support roles

Support staff who can impersonate users should not also hold instance or organization administrator rights, and administrators should not use everyday support accounts to make exchanges. Map each role to its grants and review them on a schedule. Confirm that impersonation rights cannot be granted through a self-service path, and that break-glass accounts are documented and monitored.

Limits to confirm before relying on token exchange

Before a design depends on token exchange, confirm its limits in your target Zitadel version. The supported behavior comes from Zitadel's implementation of RFC 8693, which exchanges a token for a different scope, audience or subject. The most important limit is that refresh tokens cannot be sent in the exchange. A client that needs a new delegated token must start from a subject token it already holds, so the flow must be designed around access tokens or other accepted subject tokens. Ask the team that owns the client code to show which token it would present, and confirm that the exchange request works with that token before the design is signed off.

The second limit concerns how resource servers read the result. Requested access tokens are opaque unless the JWT token type is requested, so each resource server that receives an exchanged token needs a way to validate it. Opaque tokens require introspection against Zitadel on every call, which adds a network dependency and latency to the request path and shifts trust to the introspection endpoint. JWT results can be validated locally but carry their claims for their whole lifetime, which affects how quickly a revoked delegation takes effect. Decide the token type per audience, and test revocation behavior in your own environment rather than assuming it.

Finally, confirm three behaviors with Zitadel and in a test instance: how exchange behaves across instances and organizations, whether the exchanged token keeps the expected organization context, and how each exchange appears in the audit trail. Check which actor is recorded, whether the delegated subject and the original caller can both be traced, and whether those events reach your SIEM. Use the Zitadel token exchange guide as the starting reference, and write these results into the design record so the impersonation and delegation controls can be reviewed later.

Questions teams ask about token exchange in Zitadel

What drives the cost of building token exchange in Zitadel?

The main cost driver is how many services need exchanged tokens and how many delegation paths you must model. Each exchange flow needs its own design for audience, scope and subject, plus tests that prove a token cannot be widened beyond what the caller was allowed. Costs fall into one-time design and build work, then recurring review whenever a new service or role joins the flow. Ask any partner for a written scope that lists each exchange path, the services involved, the test cases and the handover items, because a quote without that breakdown cannot be compared. Zitadel's documentation does not publish effort figures for this work, so treat any number a vendor gives as a claim to verify against your own scope.

What does the client's team need to provide for a token exchange project?

Your team needs to provide the list of delegation and impersonation use cases, the owners who approve each one, and the projects, applications and roles that Zitadel already models. The team also needs an identity engineer who can read the Zitadel token exchange guide, configure applications and grants, and decide which token type each service accepts. Security should supply the rules for who may impersonate whom, how long an exchanged token may live and how exchanges are logged. Without these inputs, the build stalls on policy decisions rather than configuration. Confirm in writing which of these inputs the partner expects from you and which it will draft.

What makes the timeline for token exchange longer or shorter?

Timelines grow with the number of exchange paths, the number of downstream services that must accept the new token type, and the amount of policy agreement needed before build starts. Integrating a service that validates JWT access tokens differently from one that expects opaque tokens adds testing time. Approval cycles inside your organization often take longer than configuration. A shorter timeline usually comes from a small set of well-defined use cases, existing grants and a single owner who signs off on decisions. Ask for milestones tied to each exchange path in the written scope, so progress can be measured without relying on a single end date.

Can our own team implement token exchange in Zitadel without a partner?

Yes, a team with strong identity engineering skills can implement token exchange in Zitadel, because the feature is documented and configured through the platform. The harder part is the design: deciding which identities may act for others, limiting scopes and auditing each exchange. Teams new to RFC 8693 usually underestimate testing of negative cases, such as refresh tokens that cannot be sent in an exchange. A partner is most useful for an independent review of the permission model, for testing the paths an attacker would try, or for building the design while your engineers learn the feature. Compare the cost of a partner's scoped work with the time your engineers would spend on the same design.

Should we choose opaque or JWT tokens for exchanged access tokens?

Choose opaque tokens when the receiving service can call Zitadel to validate them and you want the token to reveal nothing about its contents to the client. Choose JWT when the receiving service validates tokens locally and needs claims such as audience, subject and scope without a network call. Zitadel returns opaque access tokens unless the JWT token type is requested in the exchange, so the decision is made at the request level. Check each downstream service's validation library before deciding, and confirm the token lifetime and claims each path needs. Mixing both types across services is possible but doubles the validation logic to test and maintain.

Which permissions should we keep tight in a token exchange setup?

Keep the set of clients allowed to perform exchanges small, and limit each exchange to the narrowest audience and scope the use case needs. Impersonation should be granted to named operators for specific purposes, not to general administrators, and every exchange should be traceable to the acting identity. Review which subjects a delegated token can represent, since an overly broad subject rule turns a convenience feature into a privilege escalation path. Because refresh tokens cannot be sent in the exchange, plan how long-running sessions are re-established rather than extended. Write these rules into the design before build, and test them as negative cases.

How do we verify that token exchange behaves correctly before go-live?

Verify each exchange path with positive tests that confirm the requested audience, scope and subject appear in the result, and with negative tests that confirm disallowed requests fail. Test both opaque and JWT outcomes against every receiving service, including expired and revoked tokens. Record which identity acted, for whom and for which audience, so an investigation can reconstruct each exchange. Operations teams should also agree on how exchanges appear in logs and monitoring before go-live. Ask for the test plan and the acceptance criteria in the written scope, and confirm that retesting is included when the permission model changes.

How DeployOpen scopes and delivers Zitadel token exchange

DeployOpen plans, implements, tests, documents and supports self-hosted Zitadel inside your own infrastructure, including the token exchange flows used for impersonation and delegation. We agree the exchange paths, token types and permissions in writing before any configuration changes, so the scope your security team reviews is the scope that gets built.

How we scope

  • We list each exchange path, including the subject, actor, requested audience and scope, and who may trigger it.
  • We record which token type each consumer needs, opaque or JWT, and where a consumer depends on claims inside the token.
  • We agree in writing which administrator and service roles may perform impersonation, and which events must be logged.

How we build

  • We configure the Zitadel projects, roles and grants that gate each exchange, keeping permissions as narrow as the agreed use cases require.
  • We wire the calling services to request exchanges and confirm that refresh tokens are never sent in the exchange request.
  • We test allowed and denied exchanges, scope narrowing, audience changes and impersonation limits against the agreed matrix.

How we hand over

  • You receive a written record of every exchange path, the permissions behind it, and the token type each client expects.
  • You receive runbooks for revoking impersonation rights, rotating the credentials of calling services and reviewing exchange events.
  • We walk your engineering and security teams through the configuration so they can review changes and extend it without us.

How we support

  • Fixed-scope engagements have agreed deliverables and timelines, and changes to the exchange design are handled through a written scope change.
  • Ongoing support, Zitadel version upgrades and continuous security testing of the exchange paths are available as retainers.
  • Ask us to confirm how the agreed exchange rules behave after each Zitadel release, using the release notes from the project as the reference point.

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.