Skip to content

OIDC for machines

CI and agents should not sit on a long-lived Amendable token. Trust their OIDC identity, then exchange it for a 15-minute access token.

GitHub or GitLab ID token posted to /v1/oidc/token, then used for Git and the API.

Needs API_OIDC_TRUST (or ALL) and scope ALL_REPO.

Terminal window
curl -sS https://api.amendable.io/v1/oidc-trust-rules/setup \
-H "access-token: $AMENDABLE_TOKEN"

You get:

  • audience: amendable:<your-user-uuid>
  • token_url: https://api.amendable.io/v1/oidc/token
  • presets for GitHub Actions and GitLab CI
  • a GitHub Actions snippet

Always copy audience from this payload. Do not invent it.

Issuer: https://token.actions.githubusercontent.com

Subject examples:

  • One repo, one branch: repo:ORG/REPO:ref:refs/heads/main
  • Any ref in a repo: repo:ORG/REPO:* is a documentation example. Prefer the exact sub GitHub puts in the token (repo:ORG/REPO:environment:prod, and so on).
Terminal window
curl -sS -X POST https://api.amendable.io/v1/oidc-trust-rules \
-H "access-token: $AMENDABLE_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "gha-main",
"issuer": "https://token.actions.githubusercontent.com",
"audience": "amendable:YOUR_USER_UUID",
"subject": "repo:YOUR_ORG/YOUR_REPO:ref:refs/heads/main",
"scope": "ALL_REPO",
"grants": ["GIT_HTTP_READ", "GIT_HTTP_WRITE", "API_REPOS_WRITE"]
}'

The GitHub workflow must request that audience:

permissions:
id-token: write
contents: read

Then mint an ID token with audience=amendable:<user-uuid> and POST it to /v1/oidc/token. A full workflow is in examples/github-actions/amendable-git.yml.

Optional claim_matchers is a map of claim name to exact string match, for extra claims beyond sub.

POST /v1/oidc/token
Content-Type: application/json
{"id_token": "<jwt>"}

No access-token header. Rate limited.

201/200 body:

{
"token": "short-lived-access-token",
"token_type": "access-token",
"expires_at": "2026-08-23T01:30:00+00:00"
}

Use token as Git HTTPS password and as the access-token header until expires_at.

HTTP 401 with Invalid ID token covers a lot of failures (wrong iss, aud, sub, signature, or no matching rule). Check the trust rule, then the token claims.

Free accounts: 1 trust rule. Pro: 10. Disable or delete rules you are not using.

You cannot point a trust rule at Amendable’s own BYO issuer (oidc.amendable.io or stage.oidc.amendable.io) or at audience amendable-byo-storage. Those belong to the storage federation path only.