Course contentsShow
← System Design
Lesson 929 of 1,91924. Authentication and Authorization at ScaleFree lesson

ID Tokens and the UserInfo Endpoint

Using JWT-based ID tokens to convey authenticated user identity information.

ID Tokens and the UserInfo Endpoint

What you'll learn: How OpenID Connect uses JWT-based ID tokens to securely convey authenticated user identity information to client applications.

The Core Idea

When a user successfully authenticates through OpenID Connect, the authorization server returns an ID token—a specialized JWT that carries verified claims about the user's identity. This token answers the fundamental question: "Who is this user?"

Think of an ID token like a digital passport stamp. When you pass through border control (authentication), you receive a stamped passport (ID token) that proves who you are and when you were verified. Anyone who trusts the border authority (authorization server) can read your passport without calling back to confirm.

ID Token Structure

The ID token is a JWT containing standard claims:

  • sub: unique user identifier
  • iss: issuer (who created the token)
  • aud: audience (which client this token is for)
  • exp: expiration time
  • iat: issued-at timestamp

Plus optional claims like email, name, or custom attributes.

The UserInfo Endpoint Alternative

Sometimes the ID token is kept minimal (for performance and privacy). When the client needs additional user details, it can call the UserInfo endpoint—an API that returns extended profile information when presented with a valid access token.

This separation allows:

  • Smaller, faster ID tokens in the initial flow
  • On-demand fetching of detailed attributes
  • Privacy controls (only share what's needed, when needed)

Key Takeaway: ID tokens provide cryptographically signed identity claims as JWTs, while the UserInfo endpoint offers an API-based alternative for retrieving extended user profile data—both serving the "who is this user" question in OpenID Connect flows.