Dex, OIDC Federation, and Token Exchange: Separate User Sign-In from Workload Credentials
A source-grounded guide to Dex as an OIDC broker, the difference between ID and access tokens, and what RFC 8693 token exchange does.
On this page
Enterprise sign-on often begins as a login screen and becomes a systems problem once applications, CI jobs and internal APIs need different credentials. Dex documents an OIDC identity service with connectors to upstream providers; it also documents token exchange for machine authentication. Understanding which actor is signing in—and which resource will accept the resulting token—prevents a common design mistake: treating every JWT as an interchangeable bearer credential. [1] [3]

OIDC brokers user authentication
OpenID Connect is an identity layer on top of OAuth 2.0. It lets a relying party verify an end user’s identity based on authentication performed by an OpenID Provider and receive identity claims. The openid scope signals an OIDC authentication request; the resulting ID Token is a statement about authentication and the subject, not a universal API access token. [4]
Dex describes itself as an identity service that uses OpenID Connect and connects applications to upstream identity providers. In a typical browser flow, the application redirects a user to Dex, Dex delegates authentication to a configured connector, and Dex returns an OIDC response to the application. The application still has responsibility for validating the token’s issuer, audience, signature, expiry and nonce as required by its flow, then applying its own authorization policy. [1] [2]
Centralizing the OIDC integration can reduce the number of upstream identity integrations each application must maintain. It does not remove the need to manage redirect URIs, client registrations, signing keys, claim mapping, account linking or logout behavior. The exact connector capabilities also matter: a provider’s use of OIDC terminology does not guarantee that it implements every optional feature in the same way.
Keep ID tokens and access tokens distinct
An ID Token answers an authentication question for the client: which subject authenticated, through which issuer, and with what claims? An access token is presented to a resource server under an authorization arrangement. Its accepted audience and scopes depend on the token issuer and API contract. Sending an ID Token to an API simply because it is a signed JWT can fail validation or create a confused-deputy boundary.
A service should validate that a token was issued by an expected issuer, is intended for that resource, has not expired and carries the permissions the endpoint requires. A JWT signature says who issued the token; it does not say that every internal service should trust it. The Zanzibar architecture case study explores how a separate authorization system can answer access questions beyond authentication.
Token exchange is a separate machine flow
RFC 8693 standardizes an OAuth token-exchange grant in which a client presents a subject token and requests another token. The resulting token type, audience and authorization depend on the authorization server’s policy; the RFC defines the exchange vocabulary and protocol, not a universal least-privilege policy. The consuming resource server must still validate the resulting token. [5]
Dex’s machine-authentication guide describes exchanging an upstream access or ID token for a Dex-issued token using its /token endpoint and the RFC 8693 grant type. The guide says the current implementation supports the OIDC connector for this flow and requires a connector_id. Its example configures a public client and supplies the client ID and secret pair using HTTP Basic authentication; Dex says the client is marked public to indicate that the value is not intended to be kept secret. This is an implementation detail to understand before adopting the example, not a reason to paste a credential into a public client or assume the flow eliminates credential management. [3]
An exchange should be designed around a concrete audience and authorization policy. Decide which upstream token types are acceptable, which claims or scopes are carried forward, what resource will validate the new token, and how expiry and refresh work. If a workload token is broader than the API it reaches, the exchange has only moved the credential without reducing its authority.
Authentication is not authorization
OIDC can establish an identity and deliver claims. OAuth scopes can express delegated access. Neither replaces the application’s own decision about whether a user or workload may perform a specific action on a specific object. A service may need organization membership, resource ownership, relationship checks or contextual policy that cannot be inferred from a login event alone.
This boundary is especially important for service-to-service calls. A user token, a machine token and an exchanged token may all be syntactically valid bearer tokens, but they represent different actors and audiences. Avoid sharing a long-lived token across unrelated services simply to make a request succeed. Use short-lived credentials where available, make the audience explicit, limit granted scopes, rotate keys and reject tokens issued by unexpected authorities.
What federation does not promise
A broker does not make upstream identity providers interchangeable without configuration. Connector claims can differ; users may have multiple identifiers; and account-linking decisions affect access. OIDC federation alone does not provide automatic IdP failover, global logout, authorization policy or a guarantee that tokens from one issuer are safe at every resource. Those behaviors require explicit design and testing.
The API gateway architecture guide explains where request authentication and routing policies can be enforced at an edge boundary. Keep that layer consistent with the resource service’s token validation; a gateway check should not be the only place a sensitive API understands its authorization rules.
A deployment checklist
Start with the user flow and the machine flow separately. For browser sign-in, verify OIDC discovery, issuer and audience validation, claim mapping, redirect URI restrictions and logout behavior. For machine exchange, test accepted subject-token types, connector restrictions, requested scopes and audience, client authentication, expiry and error handling. Then confirm that every protected resource validates the tokens it receives and applies its own authorization rules.
Dex and OIDC can simplify identity integration, and token exchange can support a useful bridge between identity providers and workload credentials. The security property comes from the policy around that bridge: which token may be exchanged, who may request it, what resource accepts the result and what authority it carries. Make those boundaries explicit before treating federation as a shortcut around credential design.
Frequently asked questions
What does Dex do in an OpenID Connect login flow?
Dex is an identity service and OIDC provider that can connect applications to upstream identity providers. The relying application still needs to validate the issuer, audience, signature, expiry and any application-specific authorization rules.
Does OAuth token exchange automatically create a least-privilege token?
No. RFC 8693 defines a way to exchange a subject token for another token type, but the authorization server’s policy and the requesting client determine the resulting scopes, audience and permissions. Resource servers still need to validate the token.
Does Dex token exchange eliminate client credentials or secrets?
No. Dex’s machine-authentication guide describes a public client configuration and still requires a client ID and secret pair through HTTP Basic authentication. The documentation says the client is marked public because the value is not intended to be kept secret.



/* Comments */
Comments are offline right now — we reconnect automatically, nothing is lost.