ID Tokens and JWT Structure in OpenID Connect
What you'll learn: How OpenID Connect uses JSON Web Tokens (JWTs) as ID tokens to convey authenticated user identity with verifiable claims.
What Is an ID Token?
In OpenID Connect (the identity layer built on OAuth 2.0), an ID token is a security token that contains information about the authenticated user. Unlike access tokens that authorize resource access, ID tokens specifically prove who the user is.
ID tokens are formatted as JSON Web Tokens (JWTs)—a standardized way to securely transmit information between parties as a JSON object.
JWT Structure
A JWT consists of three parts, separated by dots (.):
header.payload.signature
1. Header
Contains metadata about the token type and signing algorithm:
{
"alg": "RS256",
"typ": "JWT"
}
2. Payload (Claims)
Contains statements about the user and authentication event. Standard claims include:
iss: Issuer (the authorization server)sub: Subject (unique user identifier)aud: Audience (the client application)exp: Expiration timestampiat: Issued-at timestampemail,name,picture: Optional user profile data
3. Signature
Cryptographically signs the header and payload to ensure integrity and authenticity. The recipient can verify the token hasn't been tampered with.
Why JWTs for Identity?
Think of an ID token like a digitally-signed passport. The issuing authority (authorization server) signs it, any party can read the claims inside, but only the holder of the private key could have created it. The client validates the signature to trust the identity claims.
Key Takeaway: ID tokens are JWTs containing cryptographically signed claims about authenticated users, enabling clients to verify user identity without calling the authorization server repeatedly.