Course contentsShow
← Security
Lesson 770 of 3,05216. Web Security - Authentication MechanismsFree lesson

ID Tokens and JWT Structure in OIDC

Analyzing ID token format, standard claims (sub, iss, aud, exp), and how they differ from OAuth access tokens.

ID Tokens and JWT Structure in OIDC

You'll learn how ID tokens in OpenID Connect convey user identity information and how their JWT format differs from OAuth access tokens.

What Is an ID Token?

In OpenID Connect, the ID token is a special credential that proves who the user is. Unlike OAuth 2.0 access tokens (which grant permission to access resources), ID tokens carry identity claims about the authenticated user. Think of an access token as a hotel room key (grants access), while an ID token is like your passport (proves your identity).

JWT Structure

ID tokens use the JSON Web Token (JWT) format, which consists of three parts separated by dots:

header.payload.signature

Each part is base64-encoded. The payload contains the identity claims.

Standard Claims in ID Tokens

ID tokens include several standardized claims:

  • sub (subject): The unique identifier for the user (e.g., "user12345")
  • iss (issuer): Who created and signed the token (e.g., "https://accounts.example.com")
  • aud (audience): Who the token is intended for—typically your application's client ID
  • exp (expiration): Unix timestamp when the token expires
  • iat (issued at): When the token was created

Key Differences from Access Tokens

While both may use JWT format, ID tokens are for the client application to learn about the user. They're not sent to resource servers. Access tokens authorize API calls. ID tokens should be validated and consumed immediately by your app, then discarded. Access tokens may be opaque strings or JWTs and are passed to APIs.

Key Takeaway: ID tokens in OIDC are JWTs containing standardized identity claims (sub, iss, aud, exp) that prove who the user is to your application, distinct from access tokens which authorize resource access.