UserInfo Endpoint and Claims Retrieval
What you'll learn: How to fetch additional user information beyond the ID token using OpenID Connect's UserInfo endpoint.
The Core Idea
When you authenticate with OpenID Connect, the ID token gives you basic identity information encoded as claims (like user ID, email, name). But sometimes you need more details—profile picture, address, phone number, etc. That's where the UserInfo endpoint comes in.
Think of it like this: the ID token is your driver's license—it has essential info right there. The UserInfo endpoint is like calling the DMV to get your full driving record. You use your access token (proof of authorization) to make an authenticated request to this endpoint and retrieve additional claims.
How It Works
After successful OIDC authentication, you receive both an ID token and an access token. To get more user data:
- Make an HTTP request to the authorization server's UserInfo endpoint
- Include your access token in the
Authorizationheader - The server validates the token and returns JSON with user claims
Claim Scopes
The claims you receive depend on the scopes you requested during authentication (from OAuth 2.0 scopes and consent). Common OIDC scopes include:
profile→ name, picture, birthdateemail→ email address and verification statusaddress→ postal addressphone→ phone number
You only get claims for scopes the user consented to and your client is authorized to request.
Why Use UserInfo?
Sometimes ID tokens are size-limited or you need fresh data. UserInfo lets you fetch current claims on-demand without re-authenticating the user. It's particularly useful when the ID token's claims feel incomplete or when you need real-time updates.
Key Takeaway: The UserInfo endpoint lets you retrieve additional user claims beyond what's in the ID token by making an authenticated request with your access token, respecting the scopes granted during authorization.