AuthenticationOpenID
OpenID Connect for engineers: tokens, claims and trust
OpenID Connect is an identity layer on top of OAuth 2.0. A provider authenticates the user and issues a signed ID token, and the application validates that token before it uses any claim.

The three parties
- The subject. In a sign-in this is a person, whom the specification calls the End-User. GitHub's OIDC provider issues a token that identifies a workflow job.
- The identity provider. The specification calls it the OpenID Provider: an OAuth 2.0 authorization server that authenticates the End-User and provides claims about that authentication.
- The relying party. The application that requires the authentication and the claims. In OAuth 2.0 terms it is the client.
ID token and access token
In the authorization code flow, the provider's token endpoint returns an ID token and an access token.
The ID token is a JSON Web Token (JWT) with claims about the authentication event: the issuer, the subject, the audience and an expiration time. It must be signed, and its audience must contain the relying party's client_id.
The access token is different. RFC 6749 defines it as a credential used to access protected resources.
The discovery document and JWKS
A provider that supports discovery publishes its configuration as JSON at the issuer URL followed by /.well-known/openid-configuration. GitHub's OIDC provider for Actions has one:
curl https://token.actions.githubusercontent.com/.well-known/openid-configurationThree fields from that response:
{
"issuer": "https://token.actions.githubusercontent.com",
"jwks_uri": "https://token.actions.githubusercontent.com/.well-known/jwks",
"id_token_signing_alg_values_supported": ["RS256"]
}issuer must be identical to the URL you used to fetch the document and to the iss claim in ID tokens from that issuer. jwks_uri is the address of the JSON Web Key Set, which holds the keys a relying party uses to validate signatures.
For key rotation, the specification has the provider put the kid of the signing key in each token's header and add new keys to the set. A verifier that sees an unfamiliar kid retrieves the keys from jwks_uri again.
The claims a relying party checks
The specification lists what a client must validate in an ID token. The signature is validated with the keys provided by the issuer, and alg should be RS256 or the algorithm the client registered. For a token received directly from the token endpoint, TLS server validation may take the place of the signature check.
Then come five claims:
issmust exactly match the provider's issuer identifier.audmust contain yourclient_id. Reject a token that lists audiences you do not trust.exp: the current time must be before it. Implementers may allow some small leeway for clock skew.nonce: if you sent one in the request, the claim must be present with the same value.subis the subject identifier, locally unique and never reassigned within the issuer.
Store users by the pair of iss and sub. The specification says those two together are the only claims a relying party can rely on as a stable identifier, and that email and name must not be used as unique identifiers.
The authorization code flow with PKCE
OpenID Connect Core lists the flow in eight steps. The client sends an authentication request to the authorization server. The server authenticates the End-User, obtains consent and sends the End-User back with an authorization code. The client presents the code at the token endpoint, receives an ID token and an access token, and validates the ID token.
The specification's own request, with line wraps for display:
GET /authorize?
response_type=code
&scope=openid%20profile%20email
&client_id=s6BhdRkqt3
&state=af0ifjsldkj
&redirect_uri=https%3A%2F%2Fclient.example.org%2Fcb HTTP/1.1
Host: server.example.comscope must contain openid. state is recommended, and nonce is optional.
PKCE is defined in RFC 7636. The client creates a code_verifier, a high-entropy random string, and derives a code_challenge from it. With the S256 method the challenge is the base64url-encoded SHA-256 hash of the verifier. The client sends code_challenge and code_challenge_method with the authorization request and code_verifier with the token request. The server denies access if the transformed verifier differs from the challenge, so an attacker who intercepts the code cannot redeem it.
RFC 9700 requires PKCE for public clients and recommends it for confidential clients.
Workloads in CI
On GitHub Actions, a job with the id-token: write permission requests a JWT from GitHub's OIDC provider, and the token is unique to that job. Its iss is https://token.actions.githubusercontent.com.
By default, GitHub builds sub from metadata such as the organization, the repository, the branch or the job's environment. For a branch the syntax is repo:ORG-NAME/REPO-NAME:ref:refs/heads/BRANCH-NAME. Repositories created after 15 July 2026 use a format that also includes the owner ID and the repository ID.
The job presents the token to the cloud provider, which checks the subject and the other claims against the conditions on the cloud role's trust definition. On a match it issues a short-lived access token, valid only while the job runs.
What to check in your setup
- Fetch the discovery document and confirm that
issueris identical to the issuer URL you configured. - Confirm that your library performs each validation listed above.
- Send
state, and sendnonceand compare it in the ID token. - Use PKCE with
S256. RFC 7636 says a client that can useS256must use it. - For CI, define at least one condition on the cloud role. GitHub's documentation requires it so that untrusted repositories cannot request access tokens.
Sources
- OpenID Connect Core 1.0 incorporating errata set 2
- OpenID Connect Discovery 1.0 incorporating errata set 2
- RFC 6749: The OAuth 2.0 Authorization Framework
- RFC 7636: Proof Key for Code Exchange by OAuth Public Clients
- RFC 9700: Best Current Practice for OAuth 2.0 Security
- OpenID Connect
- OpenID Connect reference
Want a second pair of eyes on yours? We do this work for a living.
More guides

What is inside a JWT and how to validate one
Authentication · 4 min read
Header, payload and signature, the checks to run, and the mistakes that let forged tokens in.

Set up OIDC between GitHub Actions and Azure
Authentication · 2 min read
Five steps from an app registration to a workflow that logs in with no stored secret.

Keyless deploys to AWS and Google Cloud with OIDC
Authentication · 2 min read
The trust policy for AWS and the provider setting for Google Cloud, with the workflow for each.