GOOGLE_APPLICATION_CREDENTIALS or GOOGLE_CREDENTIALS.
Follow the OIDC prerequisites, then go to the OIDC page for your environment and copy the issuer URL and subject.
Configure Google Cloud
Create a pool and provider
Create a workload identity pool, then an OIDC provider in it. Replace the IDs, your organization slug, and your project number:Grant access to the subject
Grant roles to the principal for the complete subject copied from the dashboard. For the example below, allow reading objects in a bucket:roles/iam.workloadIdentityUser on a service account and impersonate it (see service_account_impersonation_url below).
Use the identity in your task
IdentityPoolClient from google-auth-library asks a subject token supplier for a token whenever it needs a new Google access token. Return a fresh Trigger.dev OIDC token from it:
/trigger/read-from-gcs.ts
audience is the provider URL without a scheme; the OIDC token’s audience is the same URL with https:, matching --allowed-audiences.
Create the client inside run so one run’s tokens are never reused by another. Redeploy and start a new run on that deployment.
Remove the old credential
Once runs in every deployed environment authenticate this way, deleteGOOGLE_APPLICATION_CREDENTIALS and GOOGLE_CREDENTIALS from those environments on the Environment Variables page, then delete the service account key in Google Cloud.
Local Development runs can’t mint OIDC tokens. Use your own credentials there, such as gcloud auth application-default login, when ctx.environment.type === "DEVELOPMENT".
