auth.getOIDCToken() with a service that accepts external OIDC identities for workload authentication. You configure trust in that service and implement its authentication flow.
Support for OIDC user login does not necessarily mean a service accepts workload identities. Check the service’s federation documentation before starting.
Configure trust
Follow the OIDC prerequisites, then go to the OIDC page for your environment and copy the issuer URL and subject. In the receiving service:- Register your organization’s issuer,
https://oidc.trigger.dev/YOUR_ORG_SLUG, using its discovery endpoint or signing keys as required. - Configure the expected audience. Use the service’s required value, or choose one if it allows you to.
- Restrict access to the exact environment subject, directly or through the service’s identity-mapping rules.
- Grant the identity only the permissions your task needs.
Request a token
Request a token inside your task with the exact audience configured in the receiving service:auth.getOIDCToken({ audience }) returns Promise<{ token: string; expiresAt: Date }>.
Most services exchange the token for service-specific credentials. Follow their documentation for the endpoint, request format, and credential refresh behavior. Send the OIDC token directly as a bearer token only if the service explicitly supports that flow.
Keep tokens and credentials within the executing run and refresh before expiry. Redeploy with the updated CLI and SDK, then start a new run. For local Development runs, use the service’s own development credentials instead.
