Skip to main content
Workload Identity Federation (WIF) replaces a stored provider API key with a short-lived token from your own identity provider (IdP). Portkey never holds an OpenAI or Anthropic key. Revoke access by disabling the IdP app, the provider-side mapping, or the federation rule. Supported providers: OpenAI and Anthropic. Supported identity source: Configured IdP (configuredIdp). Portkey uses the OAuth 2.0 client credentials flow against your IdP.

How it works

  1. IdP token: Portkey sends a client_credentials request to your IdP’s token endpoint. The IdP returns a signed JWT for the Portkey client app.
  2. Provider exchange: Portkey exchanges that JWT with the provider:
The provider verifies the JWT signature with your IdP’s public keys. It checks iss, aud, and sub against your configured rules, then issues a short-lived access token for a service account. Portkey caches both tokens and refreshes them before they expire. Provider tokens are cached for no more than 15 minutes. Rotating the client secret invalidates the cache.

Setup overview

Start with the IdP. The provider side needs the exact iss, aud, and sub values from a real token.

Step 1: Configure the identity provider

1. Register an API app (the audience)
  1. Go to Entra admin center → App registrations → New registration. Name it portkey-wif-api.
  2. Open Expose an API and set the Application ID URI, for example api://<api-app-client-id>.
  3. Open Manifest and set requestedAccessTokenVersion to 2. In the legacy manifest, set accessTokenAcceptedVersion to 2. This makes Entra issue v2 tokens with a stable issuer.
2. Register the client app (Portkey’s identity)
  1. Create another registration named portkey-wif-client.
  2. Go to Certificates & secrets → New client secret. Copy the secret value.
  3. Optional but recommended: add an app role to portkey-wif-api with Allowed member types: Applications. Grant it to portkey-wif-client under API permissions → Application permissions, then grant admin consent.
3. Collect the valuesThe resulting token contains:
Entra access tokens last 60–90 minutes. For Anthropic, set the issuer’s maximum JWT lifetime to at least 5400 seconds. See Step 2.

Verify the token

Request a token manually and decode it locally before configuring the provider. Don’t paste production tokens into third-party JWT sites.
The payload is unpadded base64url, so the jq filter converts it to padded Base64 before decoding. Copy iss, aud, and sub. The provider configuration must match them exactly.

Step 2: Configure the provider

Requires permission to manage Workload Identity Providers in the OpenAI organization.1. Create a Workload Identity ProviderGo to Organization Settings → Security → Workload Identity Provider and create an OIDC provider:Leave custom discovery and uploaded JWKS off. OpenAI fetches keys from the issuer’s discovery document.2. Add a service account mappingFrom the provider details page, add a mapping:Use exact values instead of wildcards. If more than one enabled mapping matches, OpenAI rejects the exchange.3. Copy the IDs
  • Identity Provider ID: from the Workload Identity Provider
  • Service Account ID: from the mapped service account
See OpenAI’s workload identity federation guide for CEL attribute transformations and JWKS options.

Step 3: Create the integration in Portkey

  1. Go to Model Catalog → Add Provider. Select OpenAI or Anthropic.
  2. Select Workload Identity Federation as the authentication type.
  3. Enter the IdP values from Step 1:
  1. Enter the provider values from Step 2:
  1. Save, then create a provider, for example @openai-wif.
Requests don’t change. Use the provider slug as usual:

Create via Admin API

Use provider_auth_type: "wif" in configurations when calling Create Integration. Don’t send key. WIF integrations don’t use a provider API key.

Troubleshooting

Portkey returns only the standard OAuth error code, such as invalid_client. The full IdP or provider response stays in gateway logs and never goes back to the caller.

Security recommendations

  • Use a dedicated IdP client app and provider service account for each Portkey integration and environment.
  • Match sub exactly. Avoid wildcard or prefix matches.
  • Restrict provider permissions: use mapping Permissions in OpenAI and workspace:inference in Anthropic.
  • Store the client secret in a secret manager and rotate it regularly.
  • To revoke access immediately, disable the OpenAI mapping or Anthropic rule. Cached tokens expire within 15 minutes.
Last modified on November 2, 2026