Skip to content

Token Exchange ​

Token Exchange allows tenants to authenticate against ESC APIs using tokens issued by their own external Identity Provider (IdP), without requiring users to log in through the ESC Portal.

This feature is based on the RFC 8693 (OAuth 2.0 Token Exchange) standard.

Overview ​

When Token Exchange is configured for a tenant, external JWT tokens are automatically exchanged for internal access tokens. This enables:

  • API integration: External systems can call ESC APIs directly with their own IdP tokens
  • Group mapping: Groups from the external token are mapped into the ESC authorization model
  • Transparent access: The exchange happens automatically on every API request

How It Works ​

Configuration ​

Token Exchange is configured per tenant by a tenant administrator under Tenant Administration → Settings → Token Exchange, or via the API.

SettingDescription
JWKS URLJWKS endpoint of the external IdP, used for token signature validation. Required.
Remote IdP IssuerExpected iss claim in the external token. Required.
AudiencesComma-separated audience values. The token's aud must match at least one. Recommended to prevent tokens intended for other applications from being accepted.
AD Groups ClaimClaim name in the external token that contains the user's groups. Recommended, otherwise no group-based permissions will be mapped.
Access Token Lifespan (seconds)Lifetime of the exchanged internal access token. Default 8h (28800 seconds)

Example Configuration ​

Any OIDC-compliant Identity Provider can be used. Here is an example for Microsoft Entra ID:

SettingValue
JWKS URLhttps://login.microsoftonline.com/{tenant-id}/discovery/v2.0/keys
Remote IdP Issuerhttps://login.microsoftonline.com/{tenant-id}/v2.0
AD Groups Claimroles (App Roles) or groups (AD group memberships)
AudiencesApplication (client) ID from the Entra ID app registration

Replace {tenant-id} with your Azure AD tenant ID.

Token Mapping ​

When a token is exchanged, the resulting internal access token contains:

  • preferred_username: External username prefixed with the tenant key (e.g. mytenant-john.doe)
  • tenant_key: Tenant key associated with the token's issuer

Group Resolution ​

Groups from the configured AD Groups Claim are mapped as ad_groups_trusted and available via the user info endpoint. These are used to resolve permissions.

API Usage ​

For details on how to call the API with Token Exchange, see API Authentication: Token Exchange.