Learn how an application can access the Token Vault to exchange a JWT bearer token for an access or refresh token to call external APIs.
Privileged Worker Token Exchange with Token Vault is currently in Beta. To learn more about Auth0’s product release cycle, read Product Release Stages. To participate in this program, contact Auth0 Support or your Technical Account Manager.
Token Vault supports the Privileged Worker Token Exchange, which enables a client application to exchange a signed JWT (subject token) for an external provider’s access or refresh token (requested token).After successful user authentication and authorization, a client application typically passes the user context, which contains the user’s identity, permissions, and session state, as an access or refresh token to perform the token exchange with Token Vault. In service-to-service flows, a client application, such as a backend application or service worker, may need to access resources on the user’s behalf, but because the “user is not present” in an interactive session, the client application doesn’t have access to the user context.In these service-to-service scenarios, the client application can generate a signed JWT bearer token and use it as the subject token to perform the token exchange and receive the necessary tokens to call external APIs. This means the client application can perform actions on the user’s behalf without an active user interaction or session.To use the Privileged Worker Token Exchange with Token Vault, the client application must be a highly privileged client that can also request refresh tokens from external providers via Token Vault. It should authenticate with Token Vault using asymmetric cryptographic methods such as Private Key JWT assertion or mutual TLS authentication.
To configure the client application’s privileged access to Token Vault, you need to provide a public key that will be used to verify a signed JWT as the subject token.
Auth0 Dashboard
Management API
Navigate to Applications > Applications and select your application.
Select the Settings tab, scroll to the Privileged Worker section, and toggle on Enable Privileged Worker. In the modal, select an existing public key credential or upload a new one, then select Save.
Once the credential is saved, enter at least one IP address or CIDR range in the IP Allowlist field.
Select Save Changes.
Similar to configuring JAR, you can set the Token Vault privileged access public key when creating a new client:
POST https://{yourDomain}.auth0.com/api/v2/clientsAuthorization: Bearer <YOUR_MANAGEMENT_API_ACCESS_TOKEN>Content-Type: application/json{ "name": "My App using JAR", “grant_types”: [“urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token”], “oidc_conformant”: true, “is_first_party”: true, “jwt_configuration”: { “alg”: 'RS256', }, "token_vault_privileged_access": {"credentials": [{ "name": "My credential for Token Vault Privileged Access", "credential_type": "public_key", "pem": "<YOUR PEM FILE CONTENT>", "alg": "RS256"}] },}
You can also update an existing client with the Token Vault privileged access public key:
To restrict which IP addresses may make Privileged Worker exchange requests, configure an ip_allowlist on your client. This binds the client credential to known server egress IPs, so a leaked credential cannot be used from an arbitrary IP address. Both IPv4 and IPv6 addresses and CIDR ranges are supported, with a maximum of 10 entries.
Configuring an ip_allowlist is required as part of the client configuration. Any Privileged Worker token exchange request from an IP not in the list will be rejected.
After configuring your client application with the public key, you need to create the subject token that will be exchanged for an access token for an external API. The subject token is a JSON Web Token (JWT) with the necessary claims. It is signed with the private key.The JWT has a standard format and claims:Header
Claim
Description
typ
Required. Must be token-vault-req+jwt.
kid
Optional. Only needed if you have multiple public keys configured.
Payload
Claim
Description
sub
Required. The user ID for whom you want to get the token.
aud
Required. Your tenant host.
iss
Required. Your client ID making the request.
iat
Required. Issued-at timestamp.
exp
Optional. Expiration timestamp. Tokens older than 60 seconds are rejected regardless.
jti
Required. A unique identifier for this JWT (UUID v4 recommended) for replay protection.
audit_context
Required. A human-readable string (1–256 characters) describing the business reason for this privileged access.
Do not include personally identifiable information (PII) in audit_context. This value is recorded in tenant logs and may be visible to administrators and log streaming destinations.
The following code sample is a script that generates a signed JWT subject token: