# OpenID Connect explained: how an app learns who you are

> OpenID Connect adds a sign-in layer to OAuth, so an app learns who the user is. This explainer covers the ID token, the sign-in flow and what to check.

- URL: https://iamops.dev/openid-connect-explained/
- Language: en
- Author: Argo
- Published: 2026-11-27
- Category: News
- Depth: Explainer
- Audience: Security leaders and architects
- Time: 5 min
- Topics: OpenID Connect, Basics

## TL;DR

- The identifier (ID) token tells the app [who signed in](https://iamops.dev/openid-connect-explained/#what-the-id-token-contains). The access token is for the service being called.
- The app gets the tokens in a [second step](https://iamops.dev/openid-connect-explained/#the-sign-in-step-by-step), after the user returns from the sign-in page.
- The app must [refuse a token](https://iamops.dev/openid-connect-explained/#what-the-app-must-check) whose audience is another app, even when its signature is valid.

**Audience: Beginners.** New to identity, or confused about the difference between signing in and getting access. You get the terms, one example and one picture. No code.

Every time an app says "sign in with" and sends you to another page, something is handing that app a proof of who you are. Most of the time that something is OpenID Connect. It adds sign-in on top of <abbr title="Open Authorization">OAuth</abbr>, and it defines the token the app reads. This explainer covers what that token contains and what an app must check before it believes it.

## Access versus identity

OAuth answers one question: may this app call this service for this user? The answer is an access token. The service checks the access token, and the app should treat it as opaque. Its content is for the service, not for the app.

OpenID Connect answers a second question: who just signed in? The answer is an <abbr title="identifier">ID</abbr> token. The app reads the ID token, and nothing else should. If you want the three tokens side by side, [access, refresh and ID tokens](https://iamops.dev/access-refresh-id-tokens-explained/) puts them in one table of jobs.

## What the ID token contains

The ID token is a <abbr title="JSON Web Token">JWT</abbr>, a signed <abbr title="JavaScript Object Notation">JSON</abbr> document. It carries claims about the sign-in. Five matter most. The issuer names the provider that signed the token. The subject is a stable identifier for the user at that provider. The audience must be the client ID of your app. The expiry time says when the token stops being valid. The issued-at time says when the provider created it.

The app asks for the ID token by including the `openid` scope in the sign-in request. Other scopes such as `profile` and `email` add more claims, such as a name or an email address. [Scopes and consent](https://iamops.dev/scopes-vs-consent-explained/) explains what the user agrees to when those scopes appear.

## The sign-in, step by step

The app sends the browser to the provider, with the `openid` scope in the request. The user signs in there and agrees to share what the app asked for. The provider sends the browser back to the app with a short code, not with the tokens. The app's server then sends that code to the provider's token endpoint, and gets the tokens back in a direct request.

The diagram follows the same path. It also shows the check that stops a bad token, which is the step to remember.

![Sequence diagram of an OpenID Connect sign-in between the browser, the app and the identity provider, ending with a refused ID token for another app](https://iamops.dev/img/openid-connect-explained.svg)

*The sign-in. The browser carries the user to the provider, and the app exchanges the code for tokens. The last step is the refusal.*

## What the app must check

Before the app trusts an ID token, it checks the signature against the provider's published keys. It checks the issuer, the audience and the expiry time. An ID token whose audience is another app was issued for that app. The app should refuse it, even if the signature is valid. A valid token for the wrong app is still the wrong token.

## Two mix-ups to avoid

The first mix-up is sending the ID token to an <abbr title="application programming interface">API</abbr>. An API should receive an access token, because the access token is the one meant for the service. The ID token is for the app that signed the user in.

The second mix-up is treating the subject as an email address. The subject is an identifier, so use it as a key in your database. Show the email to the user from its own claim, and expect it to change.

## Where to go next

[OAuth 2.0 flows explained](https://iamops.dev/oauth-2-flows-explained/) shows which flow carries this sign-in, and why the browser redirect matters. [<abbr title="multi-factor authentication">MFA</abbr> types and passkeys](https://iamops.dev/mfa-types-passkeys-explained/) covers how the provider decides that the person signing in is the user.

## Sources

- [OpenID Connect Core 1.0, incorporating errata set 2](https://openid.net/specs/openid-connect-core-1_0.html)
- [RFC 6749, The OAuth 2.0 Authorization Framework](https://datatracker.ietf.org/doc/html/rfc6749)

Discuss: [X](https://x.com/iamopsdev) | [LinkedIn](https://www.linkedin.com/company/iamops-dev/)
