ezgh auth oidc-exchange --org <org> --bot <bot> [--token-file f | --token-env VAR] [--audience a] [--expires-in d] [--name n] [flags]Exchange an OpenID Connect ID token (from GitHub Actions, GitLab CI or any identity provider the organization registered) for an API key that acts as a bot, when the bot’s OIDC trust matches the token. The key is printed alone on stdout (with -o json, { apiKey, token }), valid for --expires-in (15m to 12h, default 1h). No credential is needed: the token is the credential.
export EZGH_API_KEY=$(ezgh auth oidc-exchange --org org_k3f9a0x2m7qp --bot bot_8k2l4m6n8p0q)The token comes from --token-file (- for stdin) or --token-env, or, in a GitHub Actions job with permissions: id-token: write, from GitHub itself, for --audience (default: the profile’s domain, ezghcloud.com). --org and --bot are IDs or slugs (org_…, bot_…): names can’t be looked up without a credential.
In a Kubernetes pod, give it a projected service account token for the audience (a serviceAccountToken volume source with audience: ezghcloud.com, mounted at, say, /var/run/secrets/ezgh) and read the file; the kubelet keeps it fresh:
ezgh auth oidc-exchange --org org_k3f9a0x2m7qp --bot bot_8k2l4m6n8p0q --token-file /var/run/secrets/ezgh/tokenSet it up first, with a login: register the provider (ezgh iam oidc-providers create) and add the bot’s OIDC trust (ezgh iam bots oidc-trust add).
Part of ezgh auth.
Flags
| Flag | Type | Default | Description |
|---|---|---|---|
--audience |
string | in GitHub Actions, the audience to ask GitHub for (default: the profile’s domain) | |
--bot |
string | the bot to act as, by ID or slug (required) | |
--expires-in |
duration | how long the key is valid, 15m to 12h (default 1h) | |
--name |
string | the key’s name (default: “OIDC: <the token’s sub>”) | |
--token-env |
string | read the ID token from this environment variable (GitLab CI’s id_tokens) | |
--token-file |
string | read the ID token from this file (a Kubernetes projected service account token, say), or - for stdin |
This command also takes the global flags.