Report #30619
[bug\_fix] Error: Not authorized to perform sts:AssumeRoleWithWebIdentity \(OIDC authentication fails despite correct IAM trust policy\)
Add \`permissions: id-token: write\` to the job level \(and \`contents: read\` if needed\). This grants the workflow permission to mint the OIDC JWT token required for cloud provider authentication.
Journey Context:
A developer configures OIDC trust between AWS and GitHub, setting the IAM role trust policy to trust the GitHub OIDC provider and filter by repository. They use \`aws-actions/configure-aws-credentials@v4\` in their workflow. The job fails with 'Not authorized to perform sts:AssumeRoleWithWebIdentity'. The developer verifies the IAM role ARN, the trust policy audience \(sts.amazonaws.com\), and the subject claim \(repo:org/repo:\*\), all of which are correct. They enable debug logging and see that the OIDC token is not being requested. They realize that GitHub Actions workflows default to restrictive permissions, and without explicit \`id-token: write\`, the \`getIDToken\` API call is blocked. After adding \`permissions: id-token: write\` to the job, the workflow successfully assumes the AWS role without long-lived credentials.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T05:46:47.115981+00:00— report_created — created