Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
LABS
Glossary

ID Token

An ID Token is a JSON Web Token (JWT) issued by an OpenID Connect (OIDC) provider that contains verifiable claims about an authentication event and the authenticated user.
Chainscore © 2026
definition
AUTHENTICATION & IDENTITY

What is an ID Token?

An ID Token is a JSON Web Token (JWT) that contains verifiable claims about the identity of an authenticated user, issued by an OpenID Connect (OIDC) Identity Provider.

An ID Token is a cryptographically signed JSON Web Token (JWT) issued by an OpenID Connect (OIDC) provider, such as Auth0 or Google, following a successful user authentication. Its primary purpose is to convey identity information—or claims—about the authenticated user and the authentication event itself to a client application (the Relying Party). Standard claims within the token include the user's unique identifier (sub), the issuer (iss), the audience (aud), and the token's expiration time (exp). The client application validates the token's signature and these claims to trust the user's identity without needing to query the identity provider again.

The structure of an ID Token is defined by the OIDC Core specification. It consists of three Base64Url-encoded parts separated by dots: a header (specifying the signing algorithm), a payload (containing the claims), and a signature. Common claims include name, email, and picture, but the set of claims can be extended. Crucially, ID Tokens are intended for the client application only; they are not used to gain access to APIs or backend services. For API authorization, an Access Token is used in conjunction with the ID Token within the OAuth 2.0 and OIDC flow.

In a typical authentication flow, after a user logs in, the OIDC provider returns both an ID Token and an Access Token to the client. The client decodes and validates the ID Token's JWT signature, usually against the provider's public keys published at a jwks_uri. This validation ensures the token was issued by a trusted party, has not been tampered with, and is intended for this specific client (by checking the aud claim). This mechanism allows the client application to securely create a local session or user profile based on the verified identity information.

A key distinction is that an ID Token is for authentication (verifying 'who the user is'), while an Access Token is for authorization (granting 'what the user can do'). Confusing these two is a common security anti-pattern. ID Tokens should never be sent to a resource server (API); they lack the necessary scopes and are not designed for that purpose. The standardized, self-contained nature of the ID Token enables stateless authentication and facilitates Single Sign-On (SSO) across multiple applications that trust the same identity provider.

In blockchain and decentralized identity contexts, the concept evolves with standards like Self-Issued OpenID Connect Provider (SIOP) and Verifiable Credentials, where users can generate and sign their own ID Tokens using decentralized identifiers (DIDs). However, the core principle remains: the ID Token is a verifiable assertion of identity claims, providing a foundational layer of trust in digital interactions across both traditional and decentralized systems.

how-it-works
AUTHENTICATION MECHANISM

How an ID Token Works

An ID Token is a core component of modern identity protocols, used to securely communicate a user's authenticated identity and profile information from an identity provider to a client application.

An ID Token is a JSON Web Token (JWT) issued by an OpenID Connect (OIDC) identity provider, such as Auth0 or Google, upon successful user authentication. It is intended for the client application—the relying party—and contains a set of claims about the user's identity, such as sub (subject identifier), name, email, and email_verified. The token is digitally signed by the issuer, allowing the client to verify its authenticity and integrity using the provider's public keys, ensuring the identity data has not been tampered with.

The token's lifecycle begins when a user logs in via an OIDC flow (e.g., Authorization Code Flow). After authentication, the identity provider creates the ID Token and sends it to the client, typically alongside an access token. Unlike an access token, which is used to authorize API calls to resource servers, the ID Token is used solely for authentication. The client validates the token by checking its signature, the iss (issuer) claim, the aud (audience) claim to confirm it was issued for this specific client, and the exp (expiration time) claim.

Common claims within an ID Token include the unique user identifier (sub), authentication time (auth_time), and the identity of the authorization server (iss). It may also include custom claims. The token is designed to be stateless; the client can decode and verify it locally without querying the identity provider, which improves performance. This mechanism enables single sign-on (SSO), allowing a user to authenticate once and access multiple related applications without re-entering credentials.

A critical security distinction is that an ID Token should never be sent to a resource server or API as a means of authorization; that is the role of the access token. Misusing an ID Token for API calls is a common security anti-pattern. The token's short lifetime, typically a few minutes, limits the window for misuse if intercepted. For enhanced security, protocols like Proof Key for Code Exchange (PKCE) can be used in public clients to prevent authorization code interception attacks during the token issuance process.

In practice, when a user logs into a web application using "Sign in with Google," Google's authorization server issues an ID Token to the application. The application decodes the JWT, verifies Google's signature using published keys, and extracts the user's email and name to create a local session. This process allows the application to trust the user's identity without managing passwords directly, delegating authentication to a trusted, specialized provider.

key-features
OPENID CONNECT & OIDC

Key Features of an ID Token

An ID Token is a JSON Web Token (JWT) issued by an OpenID Connect (OIDC) provider that contains verifiable claims about the authentication of an end-user.

01

Standardized Claims

ID Tokens contain a standard set of claims defined by the OpenID Connect specification. Core claims include:

  • sub (subject): The unique identifier for the user.
  • iss (issuer): The URL of the OIDC provider.
  • aud (audience): The client ID of the relying party.
  • exp (expiration): The token's expiry timestamp.
  • iat (issued at): The time the token was issued. These claims allow the relying party to verify the token's origin and intended recipient.
02

JSON Web Token (JWT) Format

An ID Token is a specific use case of a JSON Web Token (JWT), which is a compact, URL-safe token format. A JWT consists of three Base64Url-encoded parts separated by dots:

  • Header: Specifies the token type (JWT) and the signing algorithm (e.g., RS256).
  • Payload: Contains the set of claims about the user.
  • Signature: Created by signing the encoded header and payload, allowing the token's integrity and authenticity to be verified. This structure makes it self-contained and verifiable.
03

Stateless Authentication

ID Tokens enable stateless authentication. The token itself contains all necessary user information, eliminating the need for the relying party (e.g., your application) to query the identity provider's database on every request. The application validates the token's signature and claims locally. This reduces latency and server load, making it ideal for distributed systems and single sign-on (SSO) architectures.

04

Signature & Validation

A critical security feature is the cryptographic signature, typically created using RS256 (RSA Signature with SHA-256). The relying party validates the token by:

  1. Verifying the signature using the OIDC provider's public JWKS (JSON Web Key Set).
  2. Checking the iss claim matches the known provider.
  3. Confirming the aud claim matches its own client ID.
  4. Ensuring the current time is before the exp claim. This process prevents token tampering and ensures it was issued by a trusted source.
05

Limited Lifetime

ID Tokens have a short, predefined lifetime, usually on the order of minutes (e.g., 5-15 minutes). This is enforced by the mandatory exp (expiration) claim. The short lifespan is a security measure that limits the window of opportunity for a stolen token to be used maliciously. For persistent sessions, applications use the ID Token once to authenticate a user and then establish their own session, or use a Refresh Token to obtain new ID Tokens.

06

Distinct from Access Tokens

It is crucial to distinguish an ID Token from an Access Token. They serve different purposes in the OAuth 2.0 and OpenID Connect flow:

  • ID Token: For authentication. It tells the client who the user is. Contains identity claims.
  • Access Token: For authorization. It is used by the client to access protected resources (APIs) on behalf of the user. Contains scopes and permissions. A client should never use an ID Token to call an API; it should use the Access Token.
structure-and-claims
STRUCTURE AND STANDARD CLAIMS

ID Token

An ID Token is a JSON Web Token (JWT) that contains verifiable identity assertions about an authenticated user, issued by an OpenID Connect (OIDC) provider.

An ID Token is a JSON Web Token (JWT) issued by an OpenID Connect (OIDC) provider upon successful user authentication. It contains a set of claims—key-value pairs—about the user's identity and the authentication event itself. The token is digitally signed by the issuer, allowing the relying party (RP), such as a client application, to verify its authenticity and integrity. Unlike an access token, which is used to authorize API calls, the primary purpose of an ID Token is to convey identity information to the client application.

The structure of an ID Token is defined by the OpenID Connect Core 1.0 specification. It consists of three Base64Url-encoded parts separated by dots: a header specifying the signing algorithm (e.g., RS256), a payload containing the claims, and a signature. The payload includes standard claims such as iss (issuer), sub (subject identifier), aud (audience), exp (expiration time), and iat (issued at time). These mandatory claims ensure the token can be validated and its context understood.

Beyond the standard claims, an ID Token can include additional profile claims like name, email, and picture, depending on the requested scopes (e.g., profile, email). The token is typically delivered to the client via the front-channel, embedded in the URL fragment or as a POST parameter during the OAuth 2.0 authorization code flow. The client must validate the token's signature, audience, expiration, and issuer before trusting its contents to establish the user's session securely.

OAuth 2.0 & OpenID Connect

ID Token vs. Access Token

A comparison of the two primary token types used in modern authentication and authorization flows.

FeatureID TokenAccess Token

Primary Purpose

Authentication (proves user identity)

Authorization (grants API access)

Token Standard

OpenID Connect (OIDC)

OAuth 2.0

Audience (aud claim)

The client application

The resource server/API

Format

JSON Web Token (JWT)

Opaque string or JWT

Content

User profile claims (sub, email, name)

Scopes and permissions

Validated By

Client application

Resource server/API

Used to Call

Client-side logic

Protected backend APIs

ecosystem-usage
ID TOKEN

Ecosystem Usage and Protocols

An ID Token is a JSON Web Token (JWT) issued by an OpenID Connect (OIDC) provider that contains authenticated user information for a client application, such as a dApp or wallet.

01

Core Structure & Claims

An ID Token is a cryptographically signed JSON Web Token (JWT). Its payload contains standardized claims about the user's authentication event. Key claims include:

  • sub (subject): The unique identifier for the user.
  • iss (issuer): The URL of the OIDC provider.
  • aud (audience): The client ID of the application the token is intended for.
  • exp (expiration): The token's expiry timestamp.
  • nonce: A string value used to associate a client session with the ID Token, mitigating replay attacks.
02

Authentication Flow in Web3

ID Tokens are central to Sign-In with Ethereum (SIWE) and other Web3 authentication standards. The typical flow is:

  1. A user connects their wallet (e.g., MetaMask) to a dApp.
  2. The dApp's backend (or a service like Auth0, Clerk) requests an ID Token from an OIDC-compliant provider.
  3. The user signs a SIWE message with their private key, proving control of their Ethereum address.
  4. The provider validates the signature and issues an ID Token with the user's sub claim often set to their Decentralized Identifier (DID) or wallet address.
  5. The dApp receives and verifies the ID Token's signature to establish a secure session.
03

Contrast with Access Tokens

It's critical to distinguish ID Tokens from Access Tokens, as they serve different purposes in the OAuth 2.0 and OIDC framework.

  • ID Token: Purpose is authentication. It tells the client who the user is. It is intended for the client application itself.
  • Access Token: Purpose is authorization. It is used by the client to access protected resources (like a user's data) on a Resource Server (e.g., an API). In Web3, an ID Token proves a user owns an address, while an Access Token might grant a dApp backend permission to read a user's on-chain data from an indexer API.
04

Verification & Security

Client applications must cryptographically verify every ID Token to ensure its integrity and authenticity. This involves:

  • Signature Validation: Using the OIDC provider's public keys (from its JWKS endpoint) to verify the JWT's signature.
  • Claim Validation: Checking standard claims:
    • iss matches the trusted provider.
    • aud matches the client's own ID.
    • exp has not passed.
    • nonce matches the value sent in the initial request.
  • Token Binding: Advanced security can involve binding the token to a specific client instance using mechanisms like DPoP (Demonstrating Proof-of-Possession).
05

Use Case: Session Management

A primary use for ID Tokens is to create and manage user sessions without constant wallet re-signing. After initial verification:

  • The dApp backend extracts the user's identifier (e.g., 0x... address) from the sub claim.
  • It creates a local session (e.g., via an HTTP-only cookie or a session ID) linked to this identity.
  • For subsequent requests, the session is validated instead of requiring a new wallet signature, improving user experience while maintaining security rooted in the initial cryptographic proof.
06

Related Standards & Providers

ID Token functionality is defined by and interoperates with several key standards and services:

  • OpenID Connect (OIDC): The core authentication layer on top of OAuth 2.0 that defines the ID Token.
  • JSON Web Token (JWT): The compact, URL-safe token format (RFC 7519).
  • Sign-In with Ethereum (EIP-4361): A specification for Ethereum-centric authentication that produces OIDC-compatible ID Tokens.
  • Decentralized Identifiers (DIDs): The sub claim in an ID Token can be a DID, linking to a verifiable, user-controlled identity document.
  • Providers: Services like Auth0, Clerk, NextAuth.js, and Web3Auth can act as OIDC providers issuing ID Tokens for dApps.
role-in-did-auth
STANDARDIZED CREDENTIAL

Role in Decentralized Identity (DID Auth)

An ID Token is a standardized, verifiable credential that serves as a core component in Decentralized Identity (DID) authentication and authorization flows, enabling secure and privacy-preserving user interactions across the web.

An ID Token is a cryptographically signed JSON Web Token (JWT) or similar attestation that contains claims about the identity of an end-user. In the context of Decentralized Identity (DID), it is issued by a Verifiable Credential (VC) issuer, such as a user's digital wallet, following a successful authentication event. Unlike an opaque session cookie, an ID Token is a portable, self-contained proof of authentication that can be presented to a Relying Party (RP) to assert identity attributes like a DID, name, or email, without the RP needing to query the issuer directly for each request.

The token's structure and validation are governed by open standards, most notably the OpenID Connect (OIDC) specification, which has been adapted for decentralized systems. A key feature is the sub (subject) claim, which typically contains the user's Decentralized Identifier (DID). The token is signed using the issuer's private key, and the Relying Party verifies this signature using the issuer's public key, which is resolvable via the issuer's DID Document on a verifiable data registry. This mechanism ensures the token's authenticity and integrity without centralized intermediaries.

In a DID Auth flow, the ID Token enables selective disclosure. A user can present a token that contains only the specific claims required by a service, enhancing privacy. For instance, a user might prove they are over 18 by presenting a token with a birthdate claim without revealing their exact date of birth or full name. This is a fundamental shift from traditional authentication, where services often receive a full user profile. The token's lifespan is typically short-lived, reducing the risk of replay attacks and aligning with the principle of minimal data exposure.

security-considerations
ID TOKEN

Security Considerations

ID Tokens are fundamental to decentralized identity, but their security depends on proper implementation and user awareness. Key risks include token theft, replay attacks, and reliance on issuer integrity.

01

Token Theft & Phishing

An ID Token is a bearer credential; possession grants access. The primary risks are:

  • Phishing attacks that trick users into signing malicious transactions to steal tokens.
  • Private key compromise on the user's device, allowing an attacker to impersonate the holder.
  • Malicious dApps requesting excessive permissions (scope) beyond what is necessary for their function. Protection requires secure key management (hardware wallets) and user education to verify transaction details.
02

Replay & Impersonation Attacks

A valid ID Token presented to one verifier could be replayed to another if not properly guarded. Mitigations include:

  • Using a nonce (number used once) challenge tied to a specific session or request.
  • Binding the token to a specific audience (aud claim) to prevent use against unintended services.
  • Implementing short token expiration times to limit the usable window for a stolen token.
03

Issuer Trust & Decentralization

The security of an ID Token is only as strong as the trust in its issuer. Considerations:

  • Centralized Issuers: A compromised or malicious issuer can mint fraudulent tokens or revoke valid ones, breaking the system's decentralization promise.
  • Decentralized Identifiers (DIDs): Use blockchain or distributed ledgers for verifiable, resilient issuance without a single point of failure.
  • Verifiable Credentials: A W3C standard that uses cryptographic proofs, allowing verification without contacting the original issuer.
04

Privacy & Data Minimization

ID Tokens can inadvertently leak personal data. Secure implementations follow the Principle of Least Privilege:

  • Selective Disclosure: Use zero-knowledge proofs (ZKPs) to prove a claim (e.g., age > 18) without revealing the exact birth date or full identity.
  • Minimal Claims: Request and issue only the specific user attributes (name, email) absolutely required for the service.
  • On-Chain Privacy: Avoid storing raw personal data or correlatable identifiers directly on a public blockchain.
05

Signature Verification & Algorithm Choice

A token's integrity is verified by checking its cryptographic signature. Critical checks include:

  • Valid Signature: Confirming the token was signed by the trusted issuer's private key using the expected algorithm (e.g., ES256K).
  • Algorithm Security: Deprecating weak algorithms (e.g., RS256 with small keys) in favor of modern, quantum-resistant options where possible.
  • Key Rotation: Verifiers must have a secure mechanism to fetch the issuer's current public keys if they are rotated or revoked.
06

Smart Contract Integration Risks

When ID Tokens are used for on-chain access (e.g., token-gated contracts), new attack vectors emerge:

  • Front-running: A malicious actor sees a valid token verification transaction in the mempool and replays it for their own benefit.
  • Contract Logic Flaws: Bugs in the verification logic may accept expired or malformed tokens.
  • Gas Griefing: Attackers may drain user funds by forcing expensive verification logic to be run repeatedly. Audits and using established libraries like OpenZeppelin are essential.
ID TOKEN

Common Misconceptions

ID tokens are a core component of modern authentication, but their purpose and proper use are often misunderstood. This section clarifies the most frequent points of confusion between ID tokens, access tokens, and their roles in identity and authorization.

No, an ID token and an access token serve fundamentally different purposes. An ID token is a JSON Web Token (JWT) intended for the client application to verify a user's identity. It contains claims about the user's authentication event, such as sub (subject), iss (issuer), and aud (audience). An access token, conversely, is a credential used by the client to access protected resources, like an API. It is meant for the resource server, not the client. Confusing them is a common architectural mistake that can lead to security vulnerabilities, such as using an ID token for API authorization.

ID TOKEN

Frequently Asked Questions (FAQ)

Common questions about ID Tokens, their role in decentralized identity, and their technical implementation.

An ID Token is a JSON Web Token (JWT) issued by an OpenID Connect (OIDC) provider that contains verifiable claims about the authentication event and the authenticated user. It is a core component of decentralized identity and single sign-on (SSO) systems, allowing a Relying Party (RP) to verify a user's identity without directly managing credentials. The token is digitally signed by the issuer, ensuring its integrity and authenticity. It typically contains a subject identifier (sub), issuer, audience, and expiration time, along with other optional claims like name or email. In blockchain contexts, ID Tokens can be used to link a Decentralized Identifier (DID) to a traditional authentication flow, bridging Web2 and Web3 identity systems.

ENQUIRY

Get In Touch
today.

Our experts will offer a free quote and a 30min call to discuss your project.

NDA Protected
24h Response
Directly to Engineering Team
10+
Protocols Shipped
$20M+
TVL Overall
NDA Protected Directly to Engineering Team
ID Token: Definition & Use in Decentralized Identity | ChainScore Glossary