ID Tokens

ID tokens are JWTs that contain claims about the authenticated user.

Overview

ID tokens provide proof of authentication. Unlike access tokens (which authorize API access), ID tokens answer "who is this user?"

Token Structure

ID tokens are JWTs with three parts:

eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImF1dGhvcml0eS1rZXktMSJ9.
eyJpc3MiOiJodHRwczovL2F1dGguZXhhbXBsZS5jb20iLCJzdWIiOiJ1c2VyLXV1aWQi...
.signature

Decoded Token

{
  "alg": "RS256",
  "typ": "JWT",
  "kid": "authority-key-1"
}

Payload

Standard Claims

Required Claims

Claim
Description

iss

Issuer (Authority URL)

sub

Subject (unique user ID)

aud

Audience (client ID)

exp

Expiration time

iat

Issued at time

Optional Claims

Claim
Description

auth_time

Time of authentication

nonce

Value from authorization request

at_hash

Access token hash

c_hash

Code hash (for hybrid flow)

acr

Authentication context class

amr

Authentication methods used

azp

Authorized party

Profile Claims

Claim
Description

name

Full name

given_name

First name

family_name

Last name

email

Email address

email_verified

Email verified

picture

Profile picture URL

Validation

Required Steps

  1. Verify signature using JWKS

  2. Check iss matches expected issuer

  3. Check aud contains your client ID

  4. Check exp is in the future

  5. Check iat is reasonable

  6. Check nonce matches sent value (if used)

JavaScript Example

Python Example

Using Nonce

Nonce prevents replay attacks:

Request

Validation

at_hash Validation

The at_hash claim allows ID token to be bound to access token:

Common Issues

"Invalid signature"

  • Check JWKS URL is correct

  • Verify key ID (kid) matches

  • Ensure algorithm is RS256

"Token expired"

  • Check server/client time sync

  • Token may have short lifetime

  • Refresh authentication

"Invalid audience"

  • Verify client ID in validation

  • Check token was issued for your client

Next Steps

Last updated

Was this helpful?