OpenID Connect
An extension to OAuth 2.0 that lets an app sign users in through a trusted identity provider. OpenID Connect gives the app an ID token it can validate to determine who signed in.
Also known as: OIDC, ID token
What OpenID Connect adds
OAuth 2.0 lets an application obtain access to a protected resource. On its own, it doesn't give the application a standard way to tell who signed in. OpenID Connect (OIDC) fills that gap. A trusted identity provider authenticates the user, and the application receives an ID token containing claims about the user and the authentication. The token is one part of the protocol, not another name for it.
A sign-in from start to finish
Imagine opening a company expense app and choosing Sign in with your work account. In a typical Authorization Code Flow with PKCE:
- The app redirects your browser to the company identity provider. Its request includes the
openidscope, which makes this an OIDC request, and a registered redirect URI, which tells the provider where to send the browser back. - The provider signs you in or reuses your existing sign-in session. It redirects the browser back to the app with a short-lived, single-use authorization code. The app never handles your password.
- The app exchanges the code for tokens at the provider's token endpoint. With PKCE, the app must present a verifier that matches the challenge it sent at the start. That binds the code exchange to the client that initiated the request.
- The app validates the ID token, finds or creates a local account, and can start its own session, often using a cookie. The provider's session and the app's session are separate.
Which token goes where?
The ID token is a JWT meant for the application that requested sign-in. Reading its claims isn't validation. The app checks the signature using trusted provider keys, confirms the expected issuer (iss), checks that the audience (aud) includes its client ID, and checks expiration (exp). If the request included a nonce, the app checks that it matches the claim in the token. For account lookup, use the issuer and subject (iss, sub) together rather than an email address, which can change.
The access token is for a protected API. For example, the expense app can present it to the provider's UserInfo endpoint to retrieve additional profile details. Don't send an ID token in its place or assume an access token is a JWT just because the ID token is one.
Where it comes up in practice and interviews
OIDC is common in consumer sign-in and corporate single sign-on (SSO). Multiple apps can rely on the same provider session without sharing their own sessions or permissions. Knowing that someone is an employee doesn't tell the expense app whether they can approve reimbursements; that's an authorization decision for the app.
Interviewers often ask what state, nonce, and PKCE each protect. state helps the app match the redirect response to the request it started and defend against CSRF. nonce ties the ID token to the sign-in attempt. PKCE ties redemption of the authorization code to the client that started the flow.