For Okta, Entra, Auth0, and custom IdPs that send a JWT as Bearer on every API call, see External JWT. Workload providers use token exchange — do not send the platform JWT as Bearer on every TrueFoundry call. For a comparison of both paths, see the Identity Providers overview.
Concepts
You configure three things before a workload can federate:- Identity Provider — registers the external issuer TrueFoundry should trust (
issuer, audiences, JWKS URI, and the lifetime of the TrueFoundry token returned by exchange). - Mapping — which claims on the JWT must match. On a Virtual Account this is Claims; on an Agent this is Subject.
- Principal — the Virtual Account or Agent the exchanged token acts as. Permissions stay on that principal; exchange never creates a new account.
How it works
- Your platform issues a JWT to the workload (Kubernetes projected service-account token, GitHub Actions OIDC token, AWS STS / outbound federation JWT, or GCP workload token).
- The workload exchanges that JWT at the TrueFoundry token endpoint.
- TrueFoundry verifies the signature and issuer/audience, matches Claims or Subject on the named Virtual Account or Agent, and returns a short-lived TrueFoundry access token.
- The workload calls the AI Gateway or APIs with
Authorization: Bearer <access_token>, then exchanges again before expiry. There is no refresh token.
Provider guides
Choose the guide for the environment that issues the workload JWT:GitHub Actions
CI OIDC tokens from
token.actions.githubusercontent.com.Kubernetes
Projected service-account tokens; match namespace and service account.
AWS
IAM outbound web identity (
GetWebIdentityToken) or EKS via Kubernetes.GCP
Google identity tokens or GKE; match
sub and email.Set up federation
1
Register a workload Identity Provider
Go to Settings > Security & Access > Identity Providers and add a provider. Choose Kubernetes, GitHub, AWS, or GCP.
Workload providers do not include Resolve Token To. Exchange the platform JWT; do not send it as Bearer on every call. Provider-specific issuer, JWKS, and claim examples are in the provider guides.
2
Map a Virtual Account or Agent
Create or select a Virtual Account (or Agent) and grant it the permissions the workload needs. Then add an Identity Provider Mapping for the workload provider:
- Virtual Account — use Claims (not a single Claim Value).
- Agent — use Subject (subject key / subject value). YAML still uses the
claimskey.
Paths use
/ as a nested-object separator when reading the JWT. The dot in names such as kubernetes.io is part of the key, not a path separator. Values must not contain whitespace. You can add more claim matches beyond the required keys.Full examples: GitHub Actions, Kubernetes, AWS, GCP. Also see Identity provider mappings and Agent Registry.3
Exchange the platform JWT
Obtain the platform JWT, then call the token endpoint. No
client_id and no Authorization header on this grant.Prefer the token_endpoint from OpenID discovery:GET https://<tenant-host-origin>/<tenant>/.well-known/openid-configurationThe worked path is /{tenant}/oauth2/v1/token on the tenant-host origin — same shape as OIDC discovery / issuer (no /api/svc prefix). SaaS: https://<tenant>.<your-tenant-base-domain>. Dedicated: the origin of your public control-plane URL (strip any /api/svc path if present); on dedicated installs that origin is often the same host you use for ordinary APIs, but the exchange path itself never includes /api/svc.tfy_subject is virtual_account:<name> or agent:<name>.Successful response:expires_in matches the provider’s Token TTL (or 3600 if unset). Re-exchange before expiry — there is no refresh token.Python example:4
Call TrueFoundry with the access token
Pass
Authorization: Bearer <access_token> to the AI Gateway, MCP Gateway, REST API, or SDK the same way you would a VAT.Troubleshooting
Exchange returns invalid_grant
Exchange returns invalid_grant
TrueFoundry returns an opaque error when verification or claim matching fails. Check that:
- The JWT
issmatches the IdP issuer. - The JWT
audintersects the IdP allowed audiences. - Exactly one mapped Identity Provider matches the JWT issuer and audience. If the Virtual Account or Agent lists the same workload IdP more than once, exchange fails even when only one Claims / Subject set would fit. After that unique IdP row is chosen, every saved Claims / Subject entry must equal the JWT.
- Prefer a single mapping row per workload IdP on a given Virtual Account or Agent; put distinct claim sets on different principals when you need them.
- Every required Claims / Subject entry matches the JWT.
tfy_subjectnames an existing Virtual Account or Agent that maps this provider.- The subject JWT header includes a non-empty
kidthat exists on the provider JWKS.
Exchange returns unsupported_grant_type
Exchange returns unsupported_grant_type
If exchange returns
unsupported_grant_type, the workload identity grant is not enabled on this control plane — contact your TrueFoundry admin or support.Exchange returns server_error
Exchange returns server_error
If exchange returns
server_error with “Workload identity keys are not available,” the control-plane auth cache is disabled or not ready — retry after it is healthy, or escalate to TrueFoundry admin / support.Direct Bearer with the platform JWT fails
Direct Bearer with the platform JWT fails
That path is not supported for
kubernetes, github, aws, or gcp. Exchange first, then call APIs with the TrueFoundry access token.Related
- GitHub Actions · Kubernetes · AWS · GCP
- External JWT — direct Bearer with an IdP JWT
- Identity Providers overview
- Manage Virtual Accounts — Claim value vs Claims
- Agent Registry — Subject vs Claims for Agents
- API Keys — PATs and VATs when federation is not in use