OpenID Connect Core 1.0
Partial — /authorize shipped in PR 297 (OAuth-layer), but id_token issuance, nonce, and /userinfo are gaps
Source: docs/oauth/OIDC_Core.md
OpenID Connect Core 1.0 ¶
Status: OpenID Foundation Specification (not an IETF RFC)
Published: 2014 (latest errata 2024)
L-tier / T-tier: L7 · T3 (user auth) + T5 (id_token issue)
OneAuth coverage: Partial./authorizeshipped in PR 297 (OAuth-layer), but id_token issuance, nonce, and/userinfoare gaps (#339)
See also:OIDC_Discovery.md·OIDC_BCL.md·OIDC_CIBA.md·LANDSCAPE.md
In one sentence ¶
OpenID Connect Core is the identity layer on top of OAuth 2.0 — it adds the
id_token (a JWT carrying user identity claims), a standardized /userinfo
endpoint, and the protocol details for “Sign in with Google / GitHub /
Microsoft” that the world’s consumer SSO depends on.
What problem does it solve? ¶
| Without OIDC | With OIDC |
|---|---|
| OAuth gives you an access token to do things, but no way to know who the user is | id_token is a JWT identity assertion; verify it, you know the user |
| Every IdP invents its own “who is this user?” endpoint with vendor-specific claim shapes | Standardized /userinfo returning standard claims (sub, name, email, email_verified, …) |
| Cross-org SSO requires bespoke federation protocols (SAML, custom JWT) | OIDC works against any OAuth AS that’s added the identity layer |
| Session management (“are they still logged in?”) is per-vendor | OIDC adds standardized session, logout, and front-/back-channel notification |
OIDC’s importance is cultural, not just technical: it’s the spec that
made “Sign in with X” universal. Every modern consumer app that defers
auth to a third-party identity provider is using OIDC under the hood.
Relatable example ¶
When you click “Sign in with Google” on a new app:
- The browser flows through OAuth (auth-code + PKCE) — covered by the L0
spine. - The token endpoint returns
{access_token, id_token, refresh_token}—
theid_tokenis OIDC’s contribution. Without OIDC, you’d only get the
access token. - The app decodes the
id_tokenand reads:{ "iss": "https://accounts.google.com", "sub": "100123456789012345678", "aud": "32555350559.apps.googleusercontent.com", "exp": 1717003600, "iat": 1717000000, "auth_time": 1717000000, "nonce": "abcd1234...", ← matches the value the app sent "email": "sri@example.com", "email_verified": true, "name": "Sri Panyam", "picture": "https://lh3.googleusercontent.com/...", "at_hash": "x7vplJ-rh-OnePf-XKkLOA" } - The app now knows who the user is, without calling any further API.
The access token is for doing things (calling Gmail, calendar, etc.);
the id_token is for knowing who.
Every “Continue with X” button on the public internet ships this flow.
Key concepts ¶
id_tokenis a JWT. Always JWS-signed; sometimes JWE-encrypted on
top. The header hastyp:JWT; the payload carries identity claims.- Required
id_tokenclaims:iss,sub,aud,exp,iat. For
public clients,nonceis also required. nonceis the id_token’s replay defense. Client generates a fresh
randomnonce, sends it on/authorize, AS echoes it in the
id_token. Client verifies match.- Three response_type modes for getting the id_token:
code— auth-code flow, id_token at the token endpoint (the modern
recommendation; safest)id_token(orid_token token) — implicit flow, id_token in the
redirect fragment. OAuth 2.1 removes implicit; OIDC implicit is
correspondingly deprecated.code id_token(orcode id_token token) — hybrid flow, id_token
in fragment + access token via code. Niche; mostly historical.
- The
openidscope is required. That’s the magic that tells the AS
“issue an id_token, not just an access token.” Withoutscope=openid,
you’re doing pure OAuth, not OIDC. /userinfoendpoint returns identity claims for callers holding an
access token. The same claims that go in the id_token can be served
here instead — useful when you want fresh data later in a session.- Standard scopes for identity claims:
openid(required),profile,
email,address,phone. Each scope unlocks a defined claim subset
on/userinfoand (optionally) in the id_token. acrandamrclaims report how the user was authenticated
(acr = Authentication Context Class Reference; amr = Authentication
Methods References, e.g.["pwd", "mfa"]). Required for step-up auth.
Wire example ¶
Authorization request (note the scope=openid and nonce):
GET /authorize?response_type=code
&client_id=oidc-rp-1
&redirect_uri=https%3A%2F%2Fapp.example.com%2Fcb
&scope=openid+profile+email
&state=xyz
&nonce=abcd1234
&code_challenge=E9Mel...
&code_challenge_method=S256 HTTP/1.1
Host: as.example.com
Token response includes id_token:
HTTP/1.1 200 OK
Content-Type: application/json
{
"access_token": "2YotnFZFEjr1zCsicMWpAA",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "tGzv3JOkF0XG5Qx2TlKWIA",
"scope": "openid profile email",
"id_token": "eyJhbGciOi..." ← the OIDC contribution
}
Decoded id_token:
{
"iss": "https://as.example.com",
"sub": "user-42",
"aud": "oidc-rp-1",
"exp": 1717003600,
"iat": 1717000000,
"auth_time": 1717000000,
"nonce": "abcd1234",
"email": "sri@example.com",
"email_verified": true,
"name": "Sri Panyam",
"at_hash": "x7vplJ-rh-OnePf-XKkLOA"
}
Userinfo call:
GET /userinfo HTTP/1.1
Host: as.example.com
Authorization: Bearer 2YotnFZFEjr1zCsicMWpAA
HTTP/1.1 200 OK
Content-Type: application/json
{
"sub": "user-42",
"email": "sri@example.com",
"email_verified": true,
"name": "Sri Panyam"
}
Where it lands on the OAuth abstraction ¶
- L7 identity. OIDC is the identity layer; everything below it
(L0–L6) is pure delegation. - T3 (user auth at AS) is where OIDC’s
acr/amr/auth_time
semantics matter; T5 (token endpoint) is where theid_token
ships. - OIDC composes with all the OAuth extensions — PKCE, PAR, JAR, RAR,
DPoP. Most modern enterprise IdP deployments are OIDC + selected
OAuth extensions.
OAuth 2.0 status ¶
OIDC is a layer on top of OAuth 2.0. It doesn’t change OAuth’s spec
status. Universal in consumer SSO. Standard in enterprise SSO (Azure AD /
Entra ID, Okta, Auth0, Keycloak all ship OIDC by default).
OAuth 2.1 status ¶
OIDC 1.0 wasn’t updated alongside OAuth 2.1 (the OIDC working group is at
OpenID Foundation, not IETF). The two specs co-exist:
- OIDC implicit flow (response_type=id_token without code) is a peer of
OAuth 2.0’s implicit grant. 2.1 removes the OAuth implicit; OIDC
implicit is correspondingly stale (still spec-legal but rarely shipped
in new builds). - OIDC hybrid flows are 2.1-compatible only with the
code id_token
shape (notokenin response_type), with PKCE mandatory.
For new builds: ship OIDC with response_type=code, PKCE, and treat
implicit/hybrid as legacy.
Migration path (pure OAuth → OIDC) ¶
Adding OIDC to a working OAuth AS is largely additive:
- Implement id_token issuance at
/tokenwhenscope=openidis
requested. Sign with the same JWKS used for access tokens (or a
separate identity-signing key — same JWKS publication mechanism). - Wire nonce parameter handling at
/authorize— store in the
authorization code record, echo in the issued id_token. - Stand up
/userinfo— bearer-token-authed; return identity claims
per the granted scopes (openid,profile,email, …). - Update discovery with OIDC-specific fields (see
OIDC_Discovery.md). - Add scope-to-claims mapping for
profile,email,address,
phone. - Add
auth_time,acr,amremission based on how the user was
authenticated. The hard work isn’t OIDC; it’s defining your
authentication taxonomy.
When NOT to use it ¶
- Pure machine-to-machine APIs. No user → no identity → no OIDC. Use
client_credentialsonly. - Federated authorization without identity. If you’re using OAuth for
delegation but the resource server doesn’t care who the user is
beyond an opaquesub, you can skip id_token issuance and keep the
surface smaller.
OneAuth status ¶
| OIDC Core surface | Status | Where (grep-verified) | Notes |
|---|---|---|---|
/authorize endpoint |
Implemented | apiauth/authorize.go AuthorizationHandler (PR 297) |
response_type=code, whose ID token comes from the token endpoint. Hybrid types are not supported |
Implicit flow (§3.2, id_token, id_token token) |
Opt-in | apiauth/implicit.go ImplicitRedirect; OneAuthConfig.AllowImplicit |
Off by default: RFC 9700 §2.1.2 and OAuth 2.1 advise against it, since tokens pass through the browser’s URL. With AllowImplicit, a client registered for the type gets its tokens in the redirect’s fragment, never the query, with no code and no refresh token. openid and a nonce are required, the ID token carries at_hash beside an access token, and for id_token alone it carries the scope’s claims (§5.4). FAPI 2.0 refuses it. Reference server: code_flow.implicit (issue 507) |
| Authorization request by POST (§3.1.2.1) | Implemented (#478) | postedAuthorizationRequest in apiauth/authorize_mount.go |
A POST without action is sent to GET /authorize with a 303, ahead of the CSRF middleware; the consent form’s own POST always carries action |
request / request_uri parameters (§6) |
Refused (#479) | AuthorizationHandler.ValidateValues, ParseAndValidate |
request_not_supported and request_uri_not_supported at the redirect URI, with state, as §6.1 and §6.2 allow an OP that doesn’t support them. A request_uri from oneauth’s own /par still resolves. Request objects themselves are JAR, see RFC_9101.md |
id_token issuance |
Implemented (#339) | apiauth/oidc.go IDTokenIssuer / NewJWTIDTokenIssuer, called by authorizationCodeGranter |
Opt-in through OneAuthConfig.OIDC; issued when the granted scope includes openid. RS256 or ES256 only, and NewOneAuth panics on an HS256 secret (§10.1 would need the client’s own secret) |
nonce parameter handling |
Implemented (#339) | AuthorizationRequest.Nonce → core.AuthorizationCode.Nonce → the ID token |
Survives PAR (the pushed payload) and the consent form (a hidden input; a custom template must post it back) |
/userinfo endpoint |
Implemented (#339, #481) | OneAuth.UserinfoHTTPHandler in apiauth/oidc_userinfo.go |
GET and POST, Bearer or DPoP through the caller’s APIMiddleware, or the token as a form-encoded access_token on POST (RFC 6750 §2.2); 403 insufficient_scope without openid. JSON only, no signed response |
| Pairwise subject identifiers (§8.1) | Implemented | apiauth/pairwise.go PairwiseSubject, OneAuth.SubjectForClient; admin/registrar.go subjectSector |
A client registers subject_type pairwise, and its sector is its sector_identifier_uri’s host (whose document must list every redirect URI) or its redirect URIs’ one host. The ID token, userinfo and logout tokens carry HMAC-SHA256 over the sector and user ID, keyed with OIDCConfig.PairwiseSalt. Access tokens and introspection keep the user’s own ID for resource servers. Without a salt a pairwise client gets an error, never the real ID. Reference server: code_flow.pairwise_salt (issue 507) |
openid/profile/email/address/phone scope-to-claims mapping |
Implemented (#339, #481) | OIDCConfig.UserClaims, core.FilterClaimsByScope (the §5.4 table), localauth.ProfileClaims |
Userinfo serves the scope claims. The ID token carries only the claims the request asked for by name, since an access token is always issued beside it (§5.4, #480); the client SDK asks for the ones IDTokenClaims reads. ProfileClaims hands out any standard claim the profile holds, and updated_at when the user store reports accounts.LastUpdatedUser; signup stores the claims SignupPolicy.ProfileClaims lists (server: signup.profile_claims) |
auth_time claim |
Implemented (#339) | AuthorizeMountConfig.AuthTimeFromRequest → core.AuthorizationCode.AuthTime |
Left out when the deployment does not say when the user logged in |
prompt and max_age (§3.1.2.1) |
Implemented (#453) | AuthorizeVerificationHandler.Consent, needsLogin, AuthorizationRequest.Prompt / MaxAge |
prompt=login and an old login under max_age go back through the login page, whose return URL carries oa_login_after so the new login counts. prompt=none answers login_required or consent_required instead of a page. Both need AuthorizeMountConfig.AuthTimeFromRequest, and without it neither is enforced |
| Remembered consent | Implemented (#453) | core.ConsentStore (memory, FS, GORM, GAE), AuthorizeMountConfig.ConsentStore |
Approve records the scopes; a later request they cover skips the screen unless prompt=consent. prompt=none needs it to succeed. Server: code_flow.consent.remember |
claims request parameter (§5.5) |
Implemented (#453) | parseClaimsParam in apiauth/authorize.go, core.AuthorizationCode.IDTokenClaims / UserinfoClaims, collectUserClaims |
Names asked for in id_token go into the ID token; names asked for in userinfo ride the access token’s oa_userinfo_claims claim to userinfo. Every request is voluntary, so a missing essential claim is left out rather than refused. Survives PAR and the consent form (a custom template must post claims back). Discovery: claims_parameter_supported |
acr, amr |
Gap | — | Step-up. The Basic OP plan warns without acr |
at_hash claim (id_token integrity binding to access_token) |
Implemented (#339) | tokenHash in apiauth/oidc.go |
Left half of SHA-256 for RS256 / ES256 |
jti claim |
Implemented (#563) | jwtIDTokenIssuer.CreateIDToken |
32 random bytes, hex encoded, new on every ID token. A relying party that takes the ID token as an RFC 7523 assertion refuses a replay by it. Keycloak’s JWT Authorization Grant does, checked in make testkcl |
| ID token on the refresh grant | Gap (#453) | — | OIDC Core §12.2 allows one; it needs auth_time kept on the refresh token |
OIDC Discovery (/.well-known/openid-configuration) |
Implemented | apiauth.MountASMetadata co-serves both paths |
See OIDC_Discovery.md |
| ID token verification in the client SDK (relying-party side) | Implemented (#453) | client.VerifyIDToken in client/id_token.go; BrowserLoginRequest.VerifyIDToken |
The §3.1.3.7 checks against the JWKS discovery names: an asymmetric signature, iss, aud/azp, exp, iat, nonce, at_hash. Checked against Keycloak’s ID tokens in make testkcl |
| ID tokens refused as access tokens (resource-server side) | Implemented | checkAccessTokenKind in apiauth/jwt_helpers.go |
Keycloak signs ID tokens with the same key, header and aud as its access tokens, and marks them with a typ claim of ID. Since 0.1.46 the validator refuses a token whose typ claim is anything but Bearer or DPoP |
Turning it on. Set OneAuthConfig.OIDC with an RS256 or ES256
signing key, and pass localauth.ProfileClaims(users, identities) (or your
own function) as UserClaims:
oa := apiauth.NewOneAuth(apiauth.OneAuthConfig{
SigningKey: priv, SigningAlg: "ES256", VerifyKey: &priv.PublicKey,
Issuer: issuerURL, AuthorizationCodeStore: codes,
OIDC: &apiauth.OIDCConfig{UserClaims: localauth.ProfileClaims(users, identities)},
})
mux.Handle("GET /userinfo", oa.UserinfoHTTPHandler(resourceMiddleware))
mux.Handle("POST /userinfo", oa.UserinfoHTTPHandler(resourceMiddleware))
Advertise userinfo_endpoint and id_token_signing_alg_values_supported
on the ASServerMetadata you mount, and set
AuthorizeMountConfig.AuthTimeFromRequest if your session knows when the
user logged in. The reference server does all of this under
code_flow.oidc: true.
Verifying one in a Go client. LoginWithBrowser with
VerifyIDToken: true sends a fresh nonce, adds openid to the scopes,
and refuses the login unless the token response carries an ID token that
passes client.VerifyIDToken. The claims land on
ServerCredential.IDTokenClaims:
cred, err := client.NewAuthClient(issuerURL, store).LoginWithBrowser(ctx, &client.BrowserLoginRequest{
ClientID: clientID, Scopes: []string{"email"}, VerifyIDToken: true,
})
// cred.IDTokenClaims.Subject, .Email, .AuthTime, .Claims
It is opt-in because plenty of servers (oneauth without OIDC among them)
accept the openid scope and return no ID token. A client holding an ID
token from elsewhere calls client.VerifyIDToken directly, with a
keys.NewJWKSKeyStore on the discovered jwks_uri.
An ID token carries a typ claim of ID, the same marker Keycloak uses,
so checkAccessTokenKind refuses it as an access token. OIDC defines no
marker of its own, and without one an ID token signed with the AS key would
open any resource the AS protects.
Related specs ¶
- OIDC Discovery 1.0 — the discovery doc with OIDC-specific fields
- OIDC BCL — back-channel logout
- OIDC CIBA — client-initiated backchannel auth
- RFC 6749 — the OAuth framework OIDC layers on
- RFC 7519 — JWT (the id_token format)
- RFC 7515 — JWS (signs the id_token)
- RFC 7636 — PKCE; mandatory companion in modern OIDC
- RFC 9068 — JWT AT profile (sibling of OIDC’s id_token shape)
Spec links ¶
- OIDC Core 1.0
- OIDC Specifications
- OpenID Foundation — the standards body
- Errata (most recent)