The UserInfo Endpoint is a protected resource in the OpenID Connect (OIDC) specification that a client application, such as a dApp or backend service, can query with a valid access token or ID Token to retrieve a set of claims about the authenticated user. These claims are standardized attributes like sub (subject identifier), name, email, and picture. Accessing this endpoint is the final step in the OIDC flow, allowing the Relying Party (the client) to obtain verified identity information from the OpenID Provider (like Auth0, Okta, or a custom identity service).
UserInfo Endpoint
What is the UserInfo Endpoint?
The UserInfo Endpoint is a standardized API in the OAuth 2.0 and OpenID Connect (OIDC) frameworks that returns claims about the authenticated end-user.
To call the endpoint, the client makes an HTTP GET request to the provider's UserInfo URL, which is discovered via the provider's .well-known/openid-configuration document. The request must include the access token in the Authorization header as a Bearer token. The endpoint then returns a JSON object containing the requested claims. The response is typically signed and/or encrypted as per the OIDC core specification, ensuring the integrity and confidentiality of the user's profile data. This mechanism separates authentication from authorization, allowing user info to be fetched independently of the initial token grant.
In blockchain and Web3 contexts, the UserInfo Endpoint is crucial for decentralized identity implementations. While traditional OIDC providers centralize user data, decentralized protocols like SIWE (Sign-In with Ethereum) and Verifiable Credentials can adapt this pattern. Here, the endpoint might be served by a user's own identity hub or a verifiable data registry, returning DID (Decentralized Identifier)-linked claims. This enables applications to request specific user attributes (e.g., proof of KYC status or NFT ownership) in a standardized way, bridging Web2 authentication patterns with user-centric, self-sovereign identity models.
How the UserInfo Endpoint Works
The UserInfo Endpoint is a standardized API in OAuth 2.0 and OpenID Connect that returns claims about the authenticated end-user.
The UserInfo Endpoint is a protected resource in the OpenID Connect (OIDC) specification that a client application, such as a web or mobile app, calls with a valid access token to retrieve standardized claims about the authenticated user. These claims are typically returned as a JSON object and can include basic profile information like sub (subject identifier), name, email, and picture. To access this endpoint, the client must present the access token obtained during the OAuth 2.0 authorization flow, usually in the HTTP Authorization header as a Bearer token. The endpoint's location is advertised in the OpenID Provider's discovery document, often at a well-known URL like /.well-known/openid-configuration.
The primary function of this endpoint is to provide a standardized mechanism for user authentication and profile sharing, separating the authentication event (proving who you are) from authorization (granting access to resources). When a client requests the openid scope, it receives an ID Token (a JWT containing user claims) immediately upon authentication. The UserInfo Endpoint allows the client to fetch additional or more detailed claims that were not included in the ID Token, or to refresh user data without requiring the user to re-authenticate. This design supports the principle of claim-based identity, where user attributes are distributed and requested on-demand.
From a security perspective, the UserInfo Endpoint must validate the presented access token to ensure it is active, has not expired, and is authorized for the requested scopes (typically profile, email, or custom scopes). The response is often signed and/or encrypted depending on the provider's configuration to guarantee integrity and confidentiality. Developers implement this by making a simple GET or POST request to the endpoint URL. A common implementation pattern is for the client's backend to call the UserInfo Endpoint after receiving the authorization code and tokens, then use the returned claims to create or update a local user session.
Key Features of the UserInfo Endpoint
The UserInfo Endpoint is a standardized API defined by OpenID Connect (OIDC) that returns claims about the authenticated end-user. It is a core component for identity verification and user data portability in modern authentication flows.
Standardized Claims Delivery
The primary function of the endpoint is to return a JSON object containing claims about the authenticated user, such as sub (subject identifier), name, email, and picture. These claims are requested via the scope parameter during the initial authorization request (e.g., scope=openid profile email). The endpoint provides a machine-readable, standardized way for a Relying Party (client application) to retrieve verified user attributes after authentication.
Bearer Token Authentication
Access to the UserInfo Endpoint is strictly protected. The client must present the Access Token obtained during the OAuth 2.0/OIDC flow in the HTTP Authorization header using the Bearer token scheme (Authorization: Bearer <access_token>). The authorization server validates this token to ensure the request is authorized and returns claims scoped to that specific token. This mechanism ensures that user data is only disclosed to clients with a valid grant.
Subject Identifier Verification
A critical security and consistency feature is the verification of the sub claim. The subject identifier returned by the UserInfo Endpoint MUST be identical to the sub claim found in the ID Token issued for the same authentication session. This prevents identity mix-ups and ensures the client is receiving information about the same user it authenticated, maintaining integrity across tokens and API responses.
Dynamic and Protected Resource
The UserInfo Endpoint is a protected resource as defined by OAuth 2.0. Its implementation on the authorization server must validate the Access Token's scope, audience, and expiration. The data returned can be dynamic, reflecting the most current user profile information stored by the OpenID Provider. It is distinct from the static claims in an ID Token, which are signed at the time of issuance.
JSON Response and Content-Type
The endpoint must return claims in a JSON object with the Content-Type header application/json. The response body structure is defined by the OIDC specification. For JWT-based responses (less common), the endpoint can return a signed or encrypted JSON Web Token (JWT) as the claim set, using the Content-Type application/jwt. This provides an additional layer of security through cryptographic verification of the response itself.
Core Use Case: Profile Enrichment
The primary use case is for client applications to enrich user profiles after authentication. For example, after a user logs in via "Sign in with Google," the app calls Google's UserInfo Endpoint to fetch the user's full name and profile picture to display in a welcome message. It decouples authentication from user data retrieval, allowing apps to request only the data they need, when they need it, adhering to the principle of least privilege.
Standardized Claims and Data Structure
This section details the standardized data formats and user information endpoints defined by OpenID Connect, which provide a consistent and interoperable way for applications to request and receive authenticated user data.
The UserInfo Endpoint is a protected OAuth 2.0 resource server endpoint defined by the OpenID Connect Core specification that returns a set of claims about the authenticated end-user. An application, known as a Relying Party (RP), can access this endpoint by presenting a valid Access Token or ID Token to retrieve standardized user attributes such as sub (subject identifier), name, email, and picture. This mechanism decouples authentication from user data retrieval, allowing the OpenID Provider (OP) to serve as the single source of truth for user profile information.
The data returned by the UserInfo Endpoint is structured as a JSON object containing a set of claims. These claims are categorized as Standard Claims, Address Claim, and custom claims. Standard Claims are predefined fields with specific semantics, like email_verified (boolean) or locale (string). The response format and content are negotiated during the initial authentication request using scopes (e.g., profile, email, address) and the optional claims request parameter, which allows for more granular data requests.
For security, the endpoint must be protected and the client must authenticate. The manner of access is determined by the access_token value presented. If the token is an ID Token, the request is made without an Authorization header, as the token is passed as a Bearer token in a form-encoded body or query parameter. If an OAuth 2.0 Access Token is used, it is typically sent via the standard Authorization: Bearer header. The endpoint must also support CORS and should use appropriate security headers to prevent misuse.
A critical technical detail is the relationship between the sub (subject) claim in the ID Token and the UserInfo response. The sub claim value returned by the UserInfo Endpoint MUST be identical to the sub claim value in the ID Token. This binding ensures the data corresponds to the same authenticated session. Furthermore, if the email and profile scopes were not authorized, the corresponding claims might be omitted from the UserInfo response, even if they are standard claims, enforcing privacy through data minimization.
In practice, a developer implements a call to the UserInfo Endpoint after receiving an authorization code and exchanging it for tokens. For example, after a user logs in via Google OAuth with the openid and email scopes, the application can fetch the user's email address from https://openidconnect.googleapis.com/v1/userinfo. This standardized interface eliminates the need for providers to create custom API endpoints for basic profile data, greatly simplifying integration for developers across different identity platforms.
Ecosystem Usage and Implementations
The UserInfo endpoint is a standardized API call used by DeFi protocols to query a user's staking or liquidity provision position, returning critical data like deposited amounts and pending rewards.
Core Function: Querying Staking Positions
The primary function of a UserInfo endpoint is to return the state of a user's position within a staking contract or liquidity pool. A typical call returns a structured object containing:
amount: The principal amount of tokens the user has deposited (e.g., LP tokens).rewardDebt: An accounting value used to calculate pending rewards, often based on accumulated rewards per share.pendingRewards: The amount of reward tokens (e.g., governance or fee tokens) currently claimable by the user.
Standard Implementation in MasterChef
The MasterChef contract pattern, popularized by SushiSwap and widely forked, cemented the userInfo function as a standard. It maps a user's address and a pool ID (pid) to a UserInfo struct. This pattern is fundamental for yield farming and liquidity mining programs, allowing frontends and integrators to display real-time staking data and accrued yields for users.
Frontend Integration & User Dashboards
DeFi frontends and dashboards like DeBank or Zapper rely heavily on calling userInfo endpoints across multiple protocols to aggregate a user's Total Value Locked (TVL) and pending yields. This enables features like:
- A unified portfolio view of all staked assets.
- Automated reward tracking and claim notifications.
- Calculation of Annual Percentage Yield (APY) based on the user's specific share of the pool.
On-Chain Analytics and Risk Monitoring
Analytics platforms and risk engines use the UserInfo endpoint to monitor protocol health and user exposure. By querying this data, they can:
- Track the distribution of staked assets and identify concentration risk.
- Monitor reward emission rates and sustainability.
- Build models for impermanent loss based on a user's specific LP position history.
Smart Contract Automation & Keepers
Automated smart contracts or keeper networks call userInfo to check conditions for executing transactions. Common automation triggers include:
- Auto-compounding: When
pendingRewardsreach a threshold, a bot claims and re-stakes them. - Position management: Monitoring the
amountto trigger rebalancing or exit strategies based on predefined rules. - Reward optimization: Moving funds between pools based on real-time reward rates fetched from multiple
userInfocalls.
Variations and Extended Data
While the core fields are consistent, many protocols extend the UserInfo struct to include protocol-specific data. Examples include:
- Lock-up periods: Timestamps for when deposited funds become withdrawable.
- Boost multipliers: Factors that increase reward rates based on ve-token governance models.
- Fee tier information: For concentrated liquidity AMMs like Uniswap V3, detailing the price range of the user's position.
Security Considerations
The UserInfo endpoint in OAuth 2.0 and OpenID Connect (OIDC) returns claims about the authenticated user. Its security is critical for protecting user data and preventing unauthorized access.
Access Token Validation
The endpoint must validate the access token on every request. This includes checking the token's signature, expiration, issuer, audience, and scope. A common vulnerability is accepting tokens without proper validation, allowing attackers to forge or replay tokens to access user data. Implementations should use a token introspection endpoint or validate JWTs locally with the provider's public keys.
Scope Enforcement & Data Minimization
The endpoint must enforce scopes to ensure the client only receives claims it is authorized for. Returning all user attributes regardless of the token's scope violates the principle of data minimization. For example, a token with only the profile scope should not return the email claim. The server must map requested scopes to specific claim sets.
Injection & Output Encoding
User claims returned by the endpoint, especially those stored in user-controlled fields (e.g., name), must be properly encoded to prevent injection attacks. If claims are embedded in a JSON or HTML response without encoding, it could lead to Cross-Site Scripting (XSS) or JSON injection when consumed by web clients. Always set the Content-Type header (e.g., application/json) and encode special characters.
Subject Identifier Consistency
The sub (subject) claim returned by the UserInfo endpoint must exactly match the sub claim in the corresponding ID Token. Inconsistency here can break user session mapping and lead to account linkage attacks. This is a core requirement of the OpenID Connect specification to ensure a consistent identifier across all requests for the same user.
Transport Layer Security (TLS)
The UserInfo endpoint must only be accessible over HTTPS (TLS 1.2+). Transmitting access tokens and sensitive user data over an unencrypted channel allows for man-in-the-middle (MITM) attacks, where tokens can be intercepted and user data stolen. Ensure TLS is properly configured with strong cipher suites and valid certificates.
Rate Limiting & Abuse Prevention
The endpoint should implement rate limiting and anti-abuse measures. Without limits, an attacker with a valid token could make excessive requests to harvest user data or perform a denial-of-service attack. Strategies include limiting requests per token/IP address and implementing short-term caching of userinfo responses to reduce backend load.
UserInfo Endpoint vs. ID Token
A technical comparison of the two primary sources for user claims in OpenID Connect (OIDC).
| Feature / Attribute | UserInfo Endpoint | ID Token (JWT) |
|---|---|---|
Primary Purpose | On-demand retrieval of user profile claims | Authentication assertion and base claim set |
Data Freshness | Real-time (reflects current user data) | Snapshot at authentication time |
Access Method | HTTP GET request with Access Token | Directly encoded in the authentication response |
Token Requirement | OAuth 2.0 Bearer Access Token | None (self-contained after issuance) |
Standard Claim Set | OpenID Connect Standard Claims | Registered |
Data Volume | Can contain extensive profile data | Optimized for compact, essential claims |
Verification Method | Validate Access Token with Authorization Server | Cryptographic signature (JWT) validation |
Caching Recommendation | Low (data may change) | High (valid until token expiry) |
Frequently Asked Questions (FAQ)
Common technical questions about the OAuth 2.0 UserInfo endpoint, its purpose, and its implementation in blockchain and web3 authentication flows.
The UserInfo endpoint is a standardized OAuth 2.0 and OpenID Connect (OIDC) API that a client application calls with a valid access token to retrieve claims about the authenticated end-user. It returns a JSON object containing a set of claims, which are name/value pairs about the user, such as sub (subject identifier), name, and email. This endpoint is defined in the OpenID Connect Core specification and is a key component for enabling federated identity and user profile sharing across services without requiring the client to manage user credentials directly.
Get In Touch
today.
Our experts will offer a free quote and a 30min call to discuss your project.