Beta

Create a tenant

A new tenant starts with its own users, OAuth settings, audit history and logs. You are its first Tenant Admin.

ID tokens and access tokens

When the collage app asks for sign-in and photo access in one request, the token response can contain two tokens side by side. Both may be JWTs, both come from the same token endpoint, and both are called tokens. They are meant for different readers, and many mistakes with OpenID Connect begin by mixing them up. This lesson reads each one and follows where it may go.

Reading an ID token

An ID token is always a JSON Web Token, the format Inside a JWT took apart. Here is the one the photo service issues when Ava signs in to the collage app, decoded so that its parts can be read. All domains, identifiers and tokens in these examples are fictional.

Header
{
  "alg": "RS256",
  "kid": "photos-rs-2026-09",
  "typ": "JWT"
}

Claims
{
  "iss": "https://auth.photos.example",
  "sub": "user-2048",
  "aud": "photo-collage",
  "exp": 1790845500,
  "iat": 1790845200,
  "auth_time": 1790845185,
  "nonce": "demo-nonce-3"
}

iss is the issuer, the photo service's exact name. sub, the subject, identifies Ava's account at the photo service. It is the provider's stable identifier for her, and together with the issuer it is how the collage app will recognize her next time. aud, the audience, is the collage app's client ID, photo-collage. The token is addressed to the collage app and to no one else.

iat and exp record when the token was issued and when it stops being acceptable, five minutes later at 09:05 UTC on 1 October 2026. auth_time records when Ava actually authenticated, at 08:59:45, fifteen seconds before the token was issued. The two can be far apart. Had the photo service relied on a session from earlier in the day, auth_time would show that earlier time. nonce is a value the collage app generated for this sign-in attempt and sent in its request, so the token can be matched to that attempt. State and nonce explains how.

The header says the token was signed with RS256, using the photo service's key photos-rs-2026-09. As Digital signatures explained, those are hints for choosing among keys the collage app already trusts. Until the signature has been verified and the claims checked, none of these values can be relied on. Validating an ID token and the lessons after it cover each check.

Notice what is missing. There is no name, email address or scope. This ID token reports an authentication event. Profile information can arrive in other ways, which the lessons from Standard and custom claims onward describe, and some providers add a few profile claims to the ID token as well.

Two tokens, two audiences

The access token in the same response is addressed to the photo API. In the OAuth lessons, the printer carried its access token to api.photos.example without needing to understand it, and the collage app does the same. It might be a JWT or an opaque string, and its format is a matter between the photo service and its API.

The two tokens in one response
ID tokenAccess token
Who it is forThe collage app, named in aud.The photo API.
What it saysWho authenticated, when, and for which request.What access the holder has been granted.
Who checks itThe collage app, when Ava signs in.The photo API, on every request.
Where it goes nextNowhere. The collage app reads it and starts a session.In the Authorization header of API requests.
FormatAlways a JWT, usually typed JWT.Whatever the provider and API use. As a JWT, typed at+jwt.

Each token is acceptable only to its own reader. Signing someone in with an access token is the shortcut that From delegated access to sign-in warned against. The reverse is just as wrong. If the collage app sent the ID token to the photo API as a bearer token, a careful API would reject it: the audience names the collage app, not the API, and an API that accepts JWT access tokens checks that the token is typed as an access token, as Token formats and validation explains. An API that skipped those checks would let any application holding one of Ava's ID tokens act with her access.

Statement about one sign-in

Who it is for
The collage app, named in aud
Type
JWT
Who checks it
The collage app, when Ava signs in
Where it goes next
Nowhere
Sent to the photo API
Refused

Credential for an API

Who it is for
The photo API
Type
at+jwt
Who checks it
The photo API, on every request
Where it goes next
In the Authorization header
Sent to the photo API
Accepted

An API that skipped the audience and type checks would let any application holding one of Ava's ID tokens act with her access.

One token response, two readers: each token is accepted only where its audience and type say it belongs.

What an ID token does not do

An ID token is not a session. This one expires five minutes after it is issued, and nobody expects Ava to be signed out of the collage app at 09:05. Once the collage app has validated the token, it creates a session of its own, as Staying signed in described, with a lifetime chosen for the collage app. By then the ID token has done its job.

It is not permission. The ID token says who Ava is at the photo service. It does not say what she may do at the collage app, and it does not let the collage app read her photos.

It is not a live profile either. The token describes one moment. If Ava changes her name at the photo service tomorrow, today's token still describes the old account details, and if the collage app copies information into its own records, it has to decide when to refresh them.

Check your understanding

Try these questions before moving on. If an answer isn't right, use the feedback and try again.

The collage app wants to retrieve Ava's photos. Which token belongs in the Authorization header of its request to the photo API? 1 of 2

Choose one answer.

Ava's ID token expires at 09:05. What happens to her collage app session at 09:05? 2 of 2

Choose one answer.

Try it in the Lab

We value your privacy

We use cookies and similar technologies to enhance your browsing experience, and analytics to understand our traffic. By clicking "Allow all", you consent to optional analytics. Cookie Policy

Learn identity