"category": "Troubleshooting" · job/fix-not-authorized-assumerolewithwebidentity

Fixing “Not authorized to perform sts:AssumeRoleWithWebIdentity” in GitHub Actions

A checklist for the AWS OIDC error, ordered by how often each cause applies: sub format, job context, wildcards under StringEquals, audience, provider ARN and customized claims.

published updated 7 min readby Cloud Identity Security

payload.takeaways# checked against sources November 10, 2026
  • The error means STS checked the token against the role's trust policy and nothing matched.
  • The most common cause since July 2026 is a new repository sending the immutable sub format.
  • Next: the job's context (environment, pull request, tag) produces a different sub than the policy expects.
  • StringEquals does not expand wildcards; use StringLike for patterns.

This error comes from AWS STS. The job got a token from GitHub, aws-actions/configure-aws-credentials presented it, and the role’s trust policy did not allow it. Something in the token’s claims differs from what the policy compares against. Work down this list in order.

1. Is the repository sending the immutable sub format?

Repositories created, renamed or transferred after July 15, 2026 send repo:OWNER@OWNER_ID/REPO@REPO_ID:… instead of repo:OWNER/REPO:….[GitHub Changelog] A policy written for the old format will not match, even with a wildcard after the repository name, because the IDs sit in the middle of the string. AWS’s action README lists this as a cause of this exact error.[AWS (GitHub repository)]

Fix: add the immutable value, or check repository_id and repository_owner_id as separate condition keys. Details in the immutable subject guide.

2. Does the job context match the sub you wrote?

GitHub builds the second half of sub from the job, and the rules are easy to misread:[GitHub Docs]

Job sub ends with
Job that names an environment: :environment:NAME (no branch at all)
Job triggered by pull_request, no environment :pull_request
Push to a branch, no environment :ref:refs/heads/BRANCH
Push to a tag, no environment :ref:refs/tags/TAG

Common traps:

  • Adding environment: production to a deploy job changes its subject. A policy pinned to ref:refs/heads/main stops matching.
  • A pull request job never sends the branch name in sub.
  • Colons inside values are sent as %3A, so an environment called prod:us appears as environment:prod%3Aus.

3. Is there a wildcard under StringEquals?

StringEquals compares text literally. In "repo:octo-org/octo-repo:*" the asterisk only matches a real asterisk, so no token will ever match. Use StringLike for patterns, where * matches any run of characters and ? matches one.

4. Does the audience match?

The action requests the audience sts.amazonaws.com unless you set its audience input. GitHub’s and AWS’s examples check token.actions.githubusercontent.com:aud against that value.[GitHub Docs][AWS (GitHub repository)] If you set a custom audience in the workflow, the policy must expect the same string. AWS maps the aud condition key to the token’s azp claim when one is present and to aud otherwise.[AWS IAM User Guide]

5. Does the Principal point at the right provider?

The Federated principal must be the ARN of the GitHub OIDC provider in the same account as the role:

arn:aws:iam::ACCOUNT_ID:oidc-provider/token.actions.githubusercontent.com

Check that the provider exists in that account (IAM → Identity providers) and that the account ID in the ARN is right. Copying a policy between accounts without changing it is a frequent cause.

6. Has someone customized the subject claim?

Organization or repository admins can replace the default sub with a custom template through GitHub’s REST API (include_claim_keys). The customized subject replaces the default format entirely, for example repo:ORG/REPO:environment:prod:job_workflow_ref:….[GitHub Docs] If a template was applied, every trust policy for those repositories must use it. GitHub warns that tokens may be rejected if the cloud side is not updated first.

7. Does the workflow have permission to request a token?

The job (or workflow) needs:

permissions:
  id-token: write
  contents: read

Without id-token: write the job cannot request a token from GitHub at all.[GitHub Docs] In that case the failure happens before STS is called, so it usually shows a different message. Check it anyway if the job’s permissions block was recently changed.

After it works, tighten it

A policy that finally matches is not necessarily a safe policy. Run it through the checker again and look at the warnings: trust on names only, any branch allowed, no audience check. IAM refuses new GitHub trust policies that have no sub condition, but older roles may predate that check.[AWS IAM User Guide] The AWS trust policy guide covers scoping in detail.

Questions people ask

Should I print the OIDC token in the workflow log to debug this?
Avoid it. The token is a bearer credential until it expires. Build the expected claims from the repository name, IDs and job context instead, and compare them to the policy.
The same policy works for one repository and fails for another in the same organization. Why?
The failing repository was probably created, renamed or transferred after July 15, 2026, so it sends repo:OWNER@OWNER_ID/REPO@REPO_ID:… while the policy pattern expects repo:OWNER/REPO:…
Do I still need a thumbprint for the GitHub OIDC provider?
The configure-aws-credentials README says a thumbprint, if specified, is ignored. Thumbprints are not the cause of this error.

Sources

  1. aws-actions/configure-aws-credentials (README) — AWS (GitHub repository).# official documentation (action maintainer) · checked November 10, 2026 (full README)
  2. OpenID Connect reference — GitHub Docs.# official documentation (issuer) · checked November 10, 2026 (full page text)
  3. Configuring OpenID Connect in Amazon Web Services — GitHub Docs.# official documentation (issuer) · checked November 10, 2026 (full page text)
  4. Create a role for OpenID Connect federation (console) — AWS IAM User Guide.# official documentation · checked November 10, 2026 (full page text)
  5. IAM and AWS STS condition context keys — available keys for AWS OIDC federation — AWS IAM User Guide.# official documentation · checked November 10, 2026 (first 100,000 characters of the page (the GitHub and default OIDC sections were inside that range))
  6. Immutable subject claims for GitHub Actions OIDC tokens — GitHub Changelog.# official announcement (issuer) · checked November 10, 2026 (full page text)

Update history

  • — First published.
3 jobs
  1. job/github-oidc-immutable-subject category CI/CD federation

    GitHub's immutable OIDC subject claims, fixed in AWS, Azure and Google Cloud

    Repositories created after July 15, 2026 send a new sub format with owner and repository IDs. What changed, how to tell which format you get, and the trust changes for each cloud.

    · 8 min
  2. job/github-actions-aws-oidc category CI/CD federation

    Scoping a GitHub Actions trust policy in AWS

    Which condition keys to use in an IAM role trust policy for GitHub Actions, which ones are immutable, and worked examples for a branch, an environment and a reusable workflow.

    · 8 min
  3. job/github-oidc-trust-aws category CI/CD federation

    One workflow, three clouds: how AWS, Azure and Google Cloud match GitHub OIDC tokens

    The same GitHub Actions token is checked three different ways. A side-by-side comparison of where the trust lives, how claims are matched, wildcard support, limits and how failures show up.

    · 7 min