Skip to content
Latchkey

GitHub Actions OIDC "Unable to get ACTIONS_ID_TOKEN_REQUEST_URL"

The OIDC token environment variables are only injected when the job has id-token: write. Without that permission the request URL is unset.

What this error means

A cloud-login or OIDC step fails saying it cannot get ACTIONS_ID_TOKEN_REQUEST_URL or the related env var is empty.

github-actions
Error: Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable

Diagnose it: what token do you actually have?

Permission failures in Actions are almost never about your repository settings alone. Three things combine: the default GITHUB_TOKEN permission set for the repo or organization, the permissions: block in the workflow, and whether the event is a fork pull request, which downgrades the token to read-only regardless of everything else.

.github/workflows/ci.yml
- name: Show the token scopes actually granted
  run: |
    curl -sI -H "Authorization: Bearer $GITHUB_TOKEN" \
      https://api.github.com/ | grep -i "^x-oauth-scopes\|^x-accepted"
    echo "event: ${{ github.event_name }}"
    echo "fork PR: ${{ github.event.pull_request.head.repo.fork }}"
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Common causes

id-token permission not granted

OIDC tokens require id-token: write; without it the runtime does not set the request URL.

Permission set at the wrong scope

Granting id-token only at workflow level but overriding job permissions can drop it for the job.

How to fix it

Grant id-token write to the job

  1. Add permissions: id-token: write to the job using OIDC.
  2. Keep contents: read alongside it if needed.
.github/workflows/ci.yml
permissions:
  id-token: write
  contents: read

Grant the narrowest permission that works

Declaring a permissions: block switches the job from the repository default to exactly what you list, so an incomplete block is a common cause of a new failure right after someone tightened security. List every scope the job needs, not just the one that failed.

.github/workflows/ci.yml
permissions:
  contents: read        # checkout
  packages: write       # push to GHCR
  id-token: write       # OIDC to a cloud provider
  pull-requests: write  # comment on or label a PR
  checks: write         # publish check runs

How to prevent it

  • Add id-token: write to every job that uses cloud OIDC login.
  • Be careful that job-level permissions do not drop the inherited id-token scope.

Frequently asked questions

What causes GitHub Actions OIDC "Unable to get ACTIONS_ID_TOKEN_REQUEST_URL"?
There are 2 common causes: id-token permission not granted and permission set at the wrong scope. OIDC tokens require id-token: write; without it the runtime does not set the request URL.
How do I fix GitHub Actions OIDC "Unable to get ACTIONS_ID_TOKEN_REQUEST_URL"?
Grant id-token write to the job. Add permissions: id-token: write to the job using OIDC.
What does GitHub Actions OIDC "Unable to get ACTIONS_ID_TOKEN_REQUEST_URL" actually mean?
A cloud-login or OIDC step fails saying it cannot get ACTIONS_ID_TOKEN_REQUEST_URL or the related env var is empty.
How do I stop GitHub Actions OIDC "Unable to get ACTIONS_ID_TOKEN_REQUEST_URL" happening again?
Add id-token: write to every job that uses cloud OIDC login. The prevention section lists 2 changes that keep it from recurring.

Related guides

References

Not every red build is your code. Latchkey repairs the ones that are not, on the runner. Start free → 30-day trial · No credit card