Skip to main content
Use Vault’s JWT auth method to exchange a Trigger.dev OIDC token for a short-lived Vault token. Your tasks read secrets with no VAULT_TOKEN stored anywhere. This works with self-managed Vault and HCP Vault. Follow the OIDC prerequisites, then go to the OIDC page for your environment and copy the issuer URL and subject.

Configure Vault

Enable the JWT auth method and point it at your issuer’s discovery document:
Create a role for each environment. Replace the subject with the complete subject copied from the dashboard, and the policy with one that allows only the paths your task reads:
bound_audiences is the audience your task requests; vault is an example, any value works if both sides match. See the JWT auth API for every role option.

Read a secret in your task

/trigger/read-from-vault.ts
The login response holds the Vault token at auth.client_token. On HCP Vault or Vault Enterprise, add an X-Vault-Namespace header to both requests. Log in inside run, and log in again if the run outlives token_ttl.

Remove the old credential

Once runs in every deployed environment log in this way, delete VAULT_TOKEN from those environments on the Environment Variables page and revoke the old token with vault token revoke. Local Development runs can’t mint OIDC tokens. Use your own Vault login there when ctx.environment.type === "DEVELOPMENT".