Docs
Live demo

Let a program sign in with its own token

Trust an OIDC token on a service account for passwordless CI, pod or agent sign-in.

On this page

Before you start: the admin role (or Change on Organization settings and security), MFA if enrolled, a Dex client with Principal enabled, and the program’s issuer, subject and audience.

  1. Open People → Create → Create service account, enter Name (Release agent) and click Create service account (note External ID).
  2. Under Token exchange, click Add trusted token.
  3. Enter exact Issuer, Subject, Audience (add Public keys (optional) if unreachable). Click Add trusted token and confirm MFA.
  4. Assign an application rule (Put a web application behind Principal sign-in).
  5. Exchange the token for a Dex access_token (connector_id: principal-<APP_ID>):
    bash
    curl -s https://dex.example.com/token \
      -d grant_type=urn:ietf:params:oauth:grant-type:token-exchange \
      -d client_id=vault -d connector_id=principal-$APPLICATION_ID \
      -d subject_token="$SUBJECT_TOKEN" -d scope="openid groups" \
      -d subject_token_type=urn:ietf:params:oauth:token-type:id_token \
      -d requested_token_type=urn:ietf:params:oauth:token-type:id_token

Trust appears under Token exchange (Pasted keys if supplied). Click Remove to block future exchanges (issued tokens last until expiry).

Issuer and subject of common programs#

Program Issuer Subject Setup
GitLab CI
https://gitlab.example.com
project_path:billing/api:ref_type:branch:ref:main
Set id_tokens.<VAR>.aud.
GitHub Actions
https://token.actions.githubusercontent.com
repo:acme/billing:ref:refs/heads/main
permissions: id-token: write.
Kubernetes
kubectl get --raw /.well-known/openid-configuration
system:serviceaccount:<ns>:<name>
Projected token. Paste /openid/v1/jwks if unreachable.
↑ ↓ to moveEnter to openEsc to close