workloadIdentity client option. The SDK gets the JWT from your platform, does the exchange, keeps the Dodo token, and refreshes it.
The workload identity options are available from these SDK versions: TypeScript 2.58.0, Python 1.124.0, Go v1.124.0, Java 1.124.0, Kotlin 1.124.0, Ruby 2.36.0, PHP 6.33.0, C# 6.42.0, and Rust 1.125.0.
Client Configuration
Give the SDK two values: the identity provider id (wip_...) and a provider helper that gets the JWT. The samples use live mode. The Java, Kotlin, and PHP clients use live mode when you do not set a mode.
Provider Helpers
Each SDK has the same set of helpers. The name follows the style of the language, for examplegithubActions() in TypeScript and github_actions() in Python.
The guide for each platform shows the configuration that the helper needs.
Environment Variables
Refresh and Retry
The SDK manages the Dodo token for you:- It does the first exchange before the first API call.
- It does a new exchange when 5 minutes or less remain on the token.
- When many requests run at the same time, the SDK does one exchange for all of them.
- If an API call gets
401, the SDK does one new exchange and tries the call one more time.
Revoke the Token
To stop the current token before it expires, for example at the end of a CI job, call revoke:Raw HTTP Exchange
Without an SDK, send the JWT toPOST /workload-identity/token. The request is an RFC 8693 token exchange and needs no API key. Use https://test.dodopayments.com for test mode.
subject_token_type can also be urn:ietf:params:oauth:token-type:id_token.
A successful response:
access_token as Authorization: Bearer <token> on your API calls. There is no refresh token. Before expires_at, get a new JWT and do the exchange again.
An error response uses the OAuth 2.0 format:
GitHub Actions
Use workload identity in a GitHub Actions workflow.
Kubernetes and EKS
Use a projected service account token.