Fact-checked by Grok 2 weeks ago

JSON Web Token

JSON Web Token (JWT) is a compact, URL-safe means of representing claims to be transferred between two parties. The claims in a JWT are encoded as a JSON object that is used as the payload of a JSON Web Signature (JWS) structure or as the plaintext of a structure, enabling the claims to be digitally signed or integrity protected with a Message Authentication Code (MAC) and/or encrypted. Published as RFC 7519 in May 2015 by authors Michael B. Jones, John Bradley, and Nat Sakimura, JWT defines a claims format suitable for space-constrained environments, such as HTTP Authorization headers and URI query parameters. A JWT Claims Set is a JSON object containing one or more claims, where each claim is a name-value pair asserting a fact about a subject. The standard specifies seven registered claim names—iss (issuer), sub (subject), aud (audience), exp (expiration time), nbf (not before), iat (issued at), and jti (JWT ID)—along with support for public and private claims. In structure, a JWT uses compact serialization, consisting of three Base64url-encoded parts separated by periods: a JOSE Header describing the token type and signing/encryption algorithm, the payload (Claims Set), and the signature or JWE components for integrity and confidentiality. It relies on RFC 7515 for JWS and RFC 7516 for JWE to provide security properties without requiring state management on the server side. JWTs can be unsecured (lacking integrity protection), nested (one JWT inside another), or combined with other JOSE (JSON Object Signing and Encryption) formats. JWT is widely adopted for secure information exchange in protocols and applications, including OpenID Connect for , as well as implementations by Mozilla Persona, Salesforce, Google, Android, Windows Azure, and . As an , it facilitates stateless token-based and , though implementations must adhere to security considerations like algorithm selection and to mitigate risks such as signature confusion attacks.

Fundamentals

Definition and Purpose

JSON Web Token (JWT) is an defined in 7519 that provides a compact and self-contained method for securely transmitting information between parties as a object. This standard enables the representation of claims—key-value pairs containing statements about an entity or event—in a digitally signed or encrypted format to ensure authenticity and integrity during transmission. By encoding the JSON object using base64url, JWTs achieve a URL-safe string that avoids issues with special characters in web contexts. The primary purposes of JWT include facilitating stateless , , and secure without the need for server-side database lookups. In , a JWT serves as a issued by an after user verification, allowing the recipient to validate the 's and extract user details directly from its contents, thereby eliminating session storage requirements on the server. For , the can embed permissions or scopes, enabling fine-grained in resource servers. Additionally, JWT supports by allowing parties to share verified data, such as user attributes, in a tamper-evident manner across distributed systems. JWT's compact and URL-safe design makes it particularly suitable for use in , (SSO), and architectures. In , it can be transmitted via HTTP headers or query parameters without imposing significant overhead, supporting scalable, stateless interactions. For SSO, JWT enables seamless across multiple domains by carrying identity information with minimal size and cross-origin compatibility. In , its self-contained nature allows tokens to propagate downstream for service-to-service verification, reducing dependency on centralized . At a high level, a JWT consists of three parts—header, , and —concatenated with periods (e.g., header.payload.), forming a single, verifiable string.

History and Development

The development of JSON Web Token (JWT) originated from efforts to create a compact, JSON-based alternative to existing token formats for secure claim transmission in web applications. Initial ideas for JSON tokens emerged in the community, influenced by Dick Hardt's proposals, with a public draft published before November 2010 at the Internet Identity Workshop (IIW). The first formal Internet-Draft, draft-jones-json-web-token-00, was submitted to the IETF in December 2010 by Michael B. Jones, proposing JWT as a means to represent claims in a URL-safe, compact format suitable for HTTP headers and parameters. This work built on predecessors like (SAML) assertions and 1.0 tokens, addressing their limitations in simplicity and performance; SAML's XML-based structure was verbose and resource-intensive. JWT's design emphasized compactness and ease of use, drawing further inspiration from Simple Web Tokens (SWTs), Magic Signatures, JSON Simple Sign, and Facebook's Canvas Applications. JWT's standardization progressed through the IETF's OAuth Working Group, with significant influence from the JSON Object Signing and Encryption (JOSE) Working Group, particularly via JSON Web Signature (JWS). Key contributors included Michael B. Jones (), John Bradley (), and Nat Sakimura (Nomura Research Institute), who led the drafting efforts. The core specification, RFC 7519, was published in May 2015, defining JWT as a JSON object encoded within a JWS or (JWE) structure to enable optional signing or encryption of claims. This was accompanied by supporting RFCs from the JOSE suite: RFC 7515 for JWS (providing the signature mechanism foundational to signed JWTs), RFC 7516 for JWE, RFC 7517 for JSON Web Key (JWK), and RFC 7518 for JSON Web Algorithms (JWA), all published in May 2015 to form a cohesive framework. Following its initial standardization, JWT saw refinements through errata and extensions to enhance security and . The RFC 7519 errata process addressed technical clarifications, such as JOSE header validation rules, with verified updates continuing into 2025. In 2020, 8725 provided best current practices for JWT implementation, updating RFC 7519 with guidance on secure deployment. As of 2025, a bis draft (draft-ietf-oauth-rfc8725bis-01) is updating these best practices, alongside an IANA registry refresh for JWT claims on , 2025. Adoption in OAuth 2.0 advanced with 9068 in 2021, which defined a JWT profile for OAuth 2.0 access tokens, standardizing claims and validation to promote vendor in flows.

Components

The header of a JSON Web Token (JWT) is a JSON object that provides about the token, including its type and the cryptographic algorithm intended for processing it. This header is serialized into a compact form by encoding its representation using base64url encoding, forming the first segment of the JWT string, which is typically delimited by dots (e.g., HEADER.PAYLOAD.). The header's primary role is to guide the recipient in decoding and verifying the token, ensuring compatibility with the specified operations. The header includes a required "alg" , which identifies the cryptographic algorithm used for signing or encrypting the JWT, such as "HS256" for using SHA-256 or "RS256" for using SHA-256. Additionally, the "typ" is recommended to declare the token's as "JWT", helping applications distinguish JWTs from other content in data interchanges; when present, its value must be "JWT" in uppercase. These parameters ensure the token's structure is recognized and processed correctly by compliant implementations. Optional parameters in the header include "cty", which specifies the content type for nested JWTs (e.g., "JWT" when the payload itself is another JWT), though it is not recommended for non-nested cases to avoid unnecessary complexity. The "crit" parameter, if used, lists header parameters that the recipient must understand and process; unrecognized critical parameters render the JWT invalid. For instance, a basic header JSON object might appear as follows:
{"alg": "HS256", "typ": "JWT"}
This object is then base64url-encoded (e.g., resulting in "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9") to form the header segment. During verification, the header informs the decoder of the algorithm to apply when checking the token's integrity against the signature.

Payload

The payload of a JSON Web Token (JWT) consists of a JSON object that contains claims representing statements about the token or the entity to which it relates, forming the second part of the token structure. This JSON object serves as the payload in a JSON Web Signature (JWS), where it remains unencrypted but protected for integrity, or as the plaintext input in a JSON Web Encryption (JWE), where it is encrypted for confidentiality. In the standard JWS-based JWT, the payload is not encrypted by design, relying instead on the signature for verifying its integrity and authenticity. To prepare the payload for inclusion in the JWT, the JSON object is first serialized into a encoded , then base64url-encoded without padding to ensure compactness and URL-safety. This encoding process uses the base64url variant of , which replaces standard Base64's "+" and "/" characters with "-" and "_" respectively, and omits the "=" padding to avoid issues in URL contexts. The resulting encoded becomes the second segment of the JWT, separated by a period from the header and signature. JWTs are intended to be compact, so payloads should include only essential claims to minimize size, making them suitable for transmission in HTTP headers, query parameters, or other space-constrained environments. For instance, a simple payload JSON object such as {"sub": "123"}—where "sub" indicates the subject claim—encodes to the base64url string eyJzdWIiOiIxMjMifQ. This example demonstrates the straightforward encoding that keeps the token concise while carrying verifiable data.

Signature

The signature is the third component of a JSON Web Token (JWT), which provides integrity and authenticity by cryptographically signing the encoded header and payload. It is computed using a JSON Web Signature (JWS) mechanism, where the input to the signing operation is the concatenation of the Base64url-encoded header, a period (.), and the Base64url-encoded payload. The specific algorithm for signing, such as HMAC with SHA-256 (HS256) or RSA-based signing, is declared in the JWT header's "alg" parameter. The signature value is generated by applying the chosen algorithm to the signing input with an appropriate key, such as a for symmetric algorithms like HS256. For HS256, the computation is HMAC-SHA256(base64url(UTF8(JWS Protected Header)) || '.' || base64url(JWS ), secret), where || denotes . The resulting binary signature is then encoded using Base64url encoding without padding to form the third part of the JWT. The complete JWT in compact serialization format is thus assembled as BASE64URL(UTF8(JWS Protected Header)) || '.' || BASE64URL(JWS [Payload](/page/Payload)) || '.' || BASE64URL(JWS [Signature](/page/Signature)). Verification of the signature involves recomputing it using the same and (a for symmetric methods or a public for asymmetric ones) over the provided and , then comparing it byte-for-byte with the received value. If the recomputed matches, the JWT is considered authentic and untampered; otherwise, it is rejected. This process ensures that any modification to the header or payload would invalidate the , as the signing input would change. For example, consider a JWT with the following components:
  • Encoded header: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9 (indicating )
  • Encoded payload: eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ
  • Signing input: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ
  • Secret: your-256-bit-secret
    The signature computation yields a Base64url-encoded value such as SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c, resulting in the full JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c.
The following pseudocode illustrates the signing process for HS256:
function signJWT(header, payload, secret):
    encodedHeader = base64url(UTF8(header))
    encodedPayload = base64url(UTF8([payload](/page/Payload)))
    signingInput = encodedHeader + "." + encodedPayload
    signature = HMAC-SHA256(signingInput, secret)
    encodedSignature = base64url([signature](/page/Signature))
    jwt = signingInput + "." + encodedSignature
    return jwt
This mechanism prevents tampering, as any alteration to the JWT's header or would cause the signature verification to fail, leading to rejection by the recipient.

Claims

Registered Claims

Registered claims in JSON Web Tokens (JWTs) are a set of predefined claim names registered in the (IANA) "JSON Web Token Claims" registry to promote across different systems and implementations. RFC 7519 defines seven core registered claims with standardized semantics, ensuring consistent interpretation when JWTs are used for , , and . These claims are optional but recommended for enhancing and functionality, and they are included in the JWT payload as JSON objects with values conforming to specific types such as strings, URIs, numeric dates, or arrays. The IANA registry has since expanded to include 97 claims as of October 2025. The iss (issuer) claim identifies the principal that issued the JWT, typically represented as a StringOrURI value, such as a or unique identifier for the issuing authority; its processing is application-specific. The sub (subject) claim specifies the principal about which the JWT asserts information, also a StringOrURI that must be unique within the context of the , either locally or globally, with application-specific handling. The aud (audience) claim identifies the intended recipients or audiences for the JWT, which can be a single StringOrURI or an array thereof; if the recipient is not named in this claim, the JWT must be rejected to prevent unintended use. The (expiration time) claim denotes the time after which the JWT expires and must no longer be accepted for processing, expressed as a NumericDate (a JSON numeric value representing seconds since the Unix epoch); implementations may allow for minor . Similarly, the nbf (not before) claim indicates the time before which the JWT must not be accepted, also a NumericDate, providing a validity start time with potential tolerance. The iat (issued at) claim records the time at which the JWT was issued, using a NumericDate, which helps applications assess the token's age without mandating validation. Finally, the jti (JWT ID) claim provides a for the JWT as a string, aiding in preventing replay attacks by enabling tracking of issued tokens while avoiding identifier collisions. These registered claims are placed within the JWT and use short names to minimize token size, with applications determining which are required based on security needs; values must adhere to types for . For example, a might include:
json
{
  "iss": "[https://issuer.example.com](/page/HTTPS)",
  "sub": "244",
  "exp": 1469598527
}
This snippet illustrates the , , and expiration claims in use. The standardization of these core claims in RFC 7519 establishes them in the IANA "JSON Web Token Claims" registry, facilitating widespread adoption and consistent behavior across JWT implementations without relying on custom interpretations. Additional claims registered in the IANA registry are considered public claims.

Public and Private Claims

In JSON Web Tokens (JWTs), public claims refer to claim names that are defined by specifications beyond the core registered claims and are registered in the IANA "JSON Web Token Claims" registry to ensure while avoiding name collisions. The registry currently lists 97 such claims as of October 2025, including recent additions like selective claims (e.g., _sd, sd_hash) from draft standards. These claims are not predefined in the JWT specification itself but are standardized for use in particular protocols, such as "azp" (authorized party), which identifies the party to which an ID token was issued in OpenID Connect. To prevent conflicts with other claim names, public claims often employ collision-resistant naming conventions, such as URI prefixes (e.g., "http://example.com/is_root" to indicate root user status). Private claims, in contrast, are application-specific claim names agreed upon exclusively between the JWT producer and consumer, without registration in the IANA registry or adherence to public standards. These allow for custom data exchange tailored to particular use cases, such as including {"user_role": "admin"} to convey internal permissions within a single system. However, private claims carry a risk of name clashes if multiple parties inadvertently use the same name without prior coordination, potentially leading to misinterpretation of the token's payload. Best practices for managing both types emphasize namespacing to mitigate collisions: claims should use unique identifiers like URLs or UUIDs that relate to the defining entity's domain, while claims require explicit bilateral agreements on naming to maintain clarity. For instance, a claim might appear as {":///userid": "123"} to uniquely identify a user in a federated context, whereas a claim could be {"department": "IT"} for internal organizational . A key limitation of private claims is their lack of guarantees across different systems or vendors, as they do not benefit from the provided by IANA registration, which can complicate integration in diverse environments. Public claims address this by promoting broader adoption through registry oversight, though they still require implementers to consult the IANA list for the latest additions.

Applications

Authentication and Authorization

JSON Web Tokens (JWTs) play a central role in by enabling a secure, stateless mechanism for verifying after initial . In a typical flow, a client authenticates with a using credentials such as a username and . Upon successful verification, the server generates and signs a JWT containing claims like the ("sub") identifier for the user and the issued-at ("iat"). This is then returned to the client, which stores it securely, often in local storage or a . For subsequent requests, the client includes the JWT in the HTTP header as a Bearer , formatted as "Authorization: Bearer <>". The server extracts the , verifies its signature using the or public key, and checks claims such as the expiration time ("") to ensure validity without querying a database or session store. This stateless verification process allows the server to confirm the user's identity efficiently across multiple requests. Beyond authentication, JWTs facilitate by embedding claims that define access rights. For instance, the ("aud") claim specifies the intended recipient, while custom claims like "user_role" can indicate permissions such as "admin" or "user". The server evaluates these claims to grant or deny access to protected resources; for example, an endpoint might allow access only if the token's "user_role" equals "admin". This approach integrates verification with fine-grained in a single token. A prominent example of JWT use in authentication and authorization is within OAuth 2.0 frameworks, where JWTs serve as Bearer access tokens. In this setup, an authorization server issues a JWT access token after client authentication, which resource servers validate to authorize API calls without state management. Similarly, in single sign-on (SSO) scenarios across domains, OpenID Connect employs JWT-based ID tokens to propagate user identity; after authenticating at an identity provider, the client receives an ID token that enables seamless access to relying party applications on different domains. The stateless nature of JWTs offers significant advantages for in distributed systems, as servers avoid the overhead of maintaining session state, enabling horizontal scaling and load balancing across . However, this design poses challenges for token revocation; once issued, a JWT remains valid until expiration unless additional mechanisms like blacklists or short-lived tokens with refresh grants are implemented, complicating immediate invalidation in cases of compromise.

Secure Data Exchange

JSON Web Tokens (JWTs) facilitate secure exchange by enabling parties to transmit structured information in a compact, self-contained format that ensures and authenticity without requiring direct database access. In scenarios such as API responses, a can embed like user profile details into the JWT and sign it using JSON Web Signature (JWS), allowing the recipient to verify the data's tamper-proof nature upon receipt. This approach is particularly valuable in distributed systems where immediate verification is needed without querying a central . In machine-to-machine (M2M) communications, JWTs are employed to exchange configuration parameters or operational data between services, ensuring that the information remains unaltered during transit. For instance, in architectures, one service might issue a signed JWT containing deployment-specific settings to another, which verifies the token's signature before applying the configuration. Similarly, in federated systems, JWTs serve as signed assertions to convey trust relationships or shared state across domains, promoting while maintaining . To address confidentiality in addition to integrity, the (JWE) specification extends JWT by wrapping a JWS structure within an encrypted envelope, protecting the payload from unauthorized access during exchange. This is achieved through content and optional key encryption, as defined in RFC 7516, allowing secure transmission of sensitive data over untrusted networks. A practical example involves a generating a signed JWT with temporary access data, such as a one-time resource locator, and sending it to a client application; the client then verifies the using the server's public key before utilizing the data, ensuring no modifications occurred en route. The benefits of this method include its self-contained nature, which eliminates the need for shared databases or real-time coordination, and its scalability for high-volume exchanges in cloud environments.

Security

Common Vulnerabilities

One of the most prevalent vulnerabilities in JSON Web Token (JWT) implementations arises from algorithm confusion attacks, also known as key confusion attacks. In this scenario, an attacker modifies the alg parameter in the JWT header from an asymmetric algorithm like RS256 (using a public/private key pair) to a symmetric one like HS256, then signs the token using the server's public key as the symmetric secret. Since the server treats the public key as the shared secret for HS256 verification, the forged token validates successfully, allowing unauthorized access or privilege escalation. Another common issue is the , where attackers exploit servers that accept unsigned JWTs by setting the alg header to "none" and omitting the signature portion of the token. The JWT specification permits this for unsecured contexts, but many implementations fail to reject it outright, enabling attackers to forge tokens with arbitrary claims, such as elevating user roles, by simply re-encoding the header and payload without a signature. Variations include obfuscation like mixed-case "NoNe" to bypass case-sensitive checks. Key ID (kid) injection vulnerabilities occur when the kid header parameter, intended to identify the signing key, is improperly sanitized or used to construct file paths or database queries. Attackers can inject values like ../../dev/null for path traversal to load an empty or attacker-controlled key file, or craft SQL injection payloads in the kid to manipulate key retrieval, resulting in signature bypass and token forgery. This is particularly severe in symmetric key setups where any loaded "key" can validate the token. Clock skew and expiration bypass exploits stem from inadequate validation of the exp (expiration time) and nbf (not before) claims, often due to permissive clock skew tolerances between client and server clocks. Attackers can replay expired tokens if servers ignore exp or allow excessive skew (e.g., minutes or hours), or manipulate timestamps to future dates for premature activation, leading to unauthorized access beyond intended token lifetimes. In extreme cases, this facilitates replay attacks where old tokens remain valid indefinitely. JWE key confusion affects JSON Web Encryption (JWE) variants of JWT, where mismatched key types or algorithms (e.g., ECDH-ES) allow attackers to recover private keys or decrypt content by exploiting improper input validation in key derivation processes. This extends algorithm confusion principles to encrypted tokens, potentially exposing sensitive payloads. Additionally, supply-chain attacks on JWT libraries continue to pose risks; for example, the 2023 disclosure of a remote code execution flaw in the jsonwebtoken Node.js package (CVE-2022-23529) arose from unpatched dependencies or prototype pollution in key handling, enabling arbitrary code execution during token verification across thousands of applications. More recent library-specific issues as of 2025 include algorithm confusion in the cjwt C implementation (CVE-2024-54150, December 2024) and excessive memory usage in GO-JOSE (CVE-2025-27144, February 2025). Signature stripping attacks involve removing or nullifying the component while keeping the header and intact, exploiting implementations that accept unsigned or use decoding functions without . This allows direct tampering with claims, as the processes the without checks. Finally, nested JWT exploits target multi-layered , such as a signed inner JWT encrypted in an outer JWE, where incomplete validation skips checks on inner layers. Attackers can unwrap or re-nest to outer protections, forging claims if only the outermost or is verified.

Mitigation Strategies

To mitigate security risks associated with JSON Web Tokens (JWTs), implementers must adopt a zero-trust approach by validating every aspect of the on the side, assuming all inputs could be malicious. This includes rigorous checks during both issuance and to prevent common vectors such as signature bypass or claim manipulation. As of 2025, ongoing updates to best practices, such as draft-ietf-oauth-rfc8725bis (an update to 8725), recommend additional defenses against emerging threats like encryption-signature , denial-of-service via PBES2 iteration counts or , JWT , and case-insensitive algorithm mismatches. Validation of header parameters is essential to enforce boundaries. Applications should restrict the "alg" to a predefined of secure , such as HS256 or RS256, and explicitly reject the "none" to avoid unsigned token acceptance, even if transport-layer like TLS is in place. Additionally, sanitize the "kid" ( ) header by using a strict of allowed values to prevent injection attacks that could lead to unauthorized usage or server-side request forgery. Transmission and lifecycle management further reduce exposure. Always transmit JWTs over to prevent interception and man-in-the-middle attacks, as unencrypted channels can expose tokens to . Implement short expiration times, such as 15-30 minutes for access tokens, combined with token rotation via refresh tokens to limit the window of validity and minimize damage from compromised tokens. Effective is critical for maintaining cryptographic . Use high-entropy secrets—at least 256 bits for symmetric keys—generated from cryptographically secure random sources, and rotate keys periodically to mitigate long-term exposure risks; avoid using public keys or weak passwords as signing secrets. For key distribution, employ JSON Web Keys (JWKs) as defined in RFC 7517, which enables secure sharing of public keys via endpoints like JWKS URIs while protecting private keys. Server-side verification ensures tokens are authentic and appropriate. Always verify the signature using the specified and corresponding , without trusting client-provided details. Validate registered claims such as "iss" () against expected values and "aud" () to confirm the token is intended for the recipient, preventing attacks; synchronize clocks to within a few seconds to accurately check "exp" (expiration) and "nbf" (not before) claims. validation specifically requires matching the token's "aud" array or against the verifier's identifier. For enhanced control, incorporate revocation mechanisms and monitoring. Use reference tokens—opaque identifiers stored server-side—that map to JWTs for immediate upon logout or , supplemented by a denylist of digests (e.g., SHA-256 hashes) for short-term invalidation. Monitor for anomalies such as unusual issuance patterns or validation failures to detect potential attacks early. These practices, aligned with the JWT recommendations, promote robust, zero-trust validation in production environments. Regularly update JWT libraries to address supply-chain risks.

Implementations and Standards

Libraries and Frameworks

Several open-source libraries facilitate the implementation of JSON Web Tokens (JWT) across major programming languages, offering capabilities for encoding, decoding, signing, and verifying tokens while adhering to relevant standards such as RFC 7519. These libraries typically support common algorithms like and , and many extend to (JWE) and JSON Web Keys (JWK) for enhanced security. Selection of a library often prioritizes factors like active maintenance, third-party security audits, and performance benchmarks demonstrating low-latency token processing suitable for high-throughput applications. In , the jsonwebtoken library from Auth0 is a prominent choice, providing straightforward APIs for JWT creation and validation, including support for signing with HS256, RS256, and ES256 algorithms, as well as basic JWE via extensions. It handles JWK import and export for and is actively maintained with regular updates to address vulnerabilities, such as the fix for CVE-2022-23529 in version 9.0.0; users are advised to update to the latest release for ongoing patches. Performance benchmarks indicate it processes tokens in under 1ms on average for verification in Node.js environments. As of November 2025, the latest version is 9.0.2. For , PyJWT offers a pure-Python implementation focused on encoding and decoding JWTs, with built-in support for signing and verification using algorithms like RS256 and PS256, and optional extensions for JWE and JWK via the pyjwt-crypto-strong or pyjwt[crypto] extras. The library undergoes regular reviews and is recommended at 2.10.1 or later as of November 2025; earlier versions addressed vulnerabilities like CVE-2022-29217 (algorithm confusion). It maintains high compatibility with Python 3.8+ and shows efficient performance with token operations completing in microseconds. Java developers commonly use jjwt for its compact enabling JWT building, parsing, and verification, supporting JWE for encrypted tokens and JWK for handling, with options for compact and JSON formats. Alternatively, Nimbus-JOSE+JWT provides a more comprehensive suite for standards, including full JWE, JWS, and JWK support across multiple algorithms, and has passed independent audits for robustness in settings. Both libraries are well-maintained—jjwt at version 0.13.0 and Nimbus at 10.6 as of November 2025—with benchmarks revealing sub-millisecond verification times even under load. Updates to these versions are essential for patches against algorithm weaknesses. In .NET, the System.IdentityModel.Tokens.Jwt package from delivers core JWT functionality for encoding, decoding, and validating tokens, integrated with the framework's cryptography providers for HS256, RS256, and ECDH-ES algorithms, alongside JWK support for key discovery. It is actively developed, with version 8.14.0 as of 2025 incorporating fixes for token replay vulnerabilities, and performance tests confirm it handles 10,000 verifications per second on standard hardware. Framework integrations streamline JWT usage in web applications. In Express.js, the express-jwt middleware authenticates requests by verifying JWTs from headers or cookies, supporting customizable validators for claims and algorithms, often paired with jsonwebtoken for signing. Spring Security incorporates JWT via its OAuth2 resource server support, enabling automatic token introspection, JWE decryption, and role-based authorization with minimal configuration. For ASP.NET Core, built-in JWT bearer authentication configures token validation middleware for API endpoints, handling JWK sets from issuers and integrating with IdentityModel for secure key rotation. Emerging languages have robust options as well. Rust's jsonwebtoken crate, at version 10.2.0 as of November 2025, emphasizes safe memory handling for JWT encoding and decoding, supporting signing with Ed25519 and , and is designed for async runtimes like without native async methods but compatible via futures. In Go, golang-jwt (version 5.2.2 or later as of November 2025) provides a modular for JWT operations, including verification in concurrent environments leveraging Go's goroutines for async-like behavior, with strong support for JWK and performance optimized for . These libraries have undergone community audits and show maintenance through frequent releases addressing CVEs, such as golang-jwt's patch for unverified parsing (CVE-2025-30204) in 5.2.2. Recent developments include addressing issues like CVE-2025-45768 in related libraries; users should monitor for updates to maintain security. JSON Web Tokens (JWTs) are part of a broader family of JSON-based standards developed by the IETF's JOSE working group, which provide mechanisms for signing, encrypting, and managing keys in web applications. The JSON Web Signature (JWS) specification, defined in 7515, enables the creation of digitally signed or MAC-protected content using JSON data structures, serving as the foundational mechanism for securing JWT payloads against tampering. Complementing this, the JSON Web Encryption (JWE) specification in 7516 outlines how to encrypt content with JSON structures, allowing JWTs to protect sensitive claims from unauthorized disclosure. The JSON Web Algorithms (JWA) registry in 7518 specifies cryptographic algorithms and identifiers compatible with JWS, JWE, and JWTs, ensuring consistent practices across implementations. Additionally, the JSON Web Key (JWK) format in 7517 represents cryptographic keys in JSON, facilitating and management for JWT operations. JWTs integrate with established authorization frameworks to enhance their utility in distributed systems. In OAuth 2.0, as specified in RFC 6749, JWTs are commonly used as compact, self-contained access tokens that convey authorization scopes and expiration details without requiring server-side state. OpenID Connect (OIDC), built atop OAuth 2.0, employs JWTs specifically as ID tokens to assert user identity and authentication details, enabling seamless across relying parties. SAML assertions, traditionally XML-based, can be mapped to JWT claims for interoperability in federated environments, leveraging the compact format of JWTs while preserving SAML's security semantics in protocols like OAuth token exchange. Further extensions address specific security and identification needs. The JSON Web Key Thumbprint in RFC 7638 provides a method to compute a deterministic over a JWK, allowing compact references to keys in JWT contexts without embedding full key details. RFC 7800 defines proof-of-possession semantics for JWTs, enabling issuers to bind tokens to a presenter's private , thereby preventing token replay or misuse by unauthorized parties. Subsequent developments have introduced alternatives to address limitations in JWT's text-based format. The Web Token (CWT), specified in RFC 8392, offers a binary-encoded counterpart using for more efficient representation in constrained environments, such as devices, while maintaining compatibility with JWT claim semantics. These related standards collectively promote by standardizing JWT usage in systems and API security architectures, allowing secure token exchange across diverse protocols and reducing integration friction in multi-vendor ecosystems.

References

  1. [1]
    RFC 7519 - JSON Web Token (JWT) - IETF Datatracker
    JSON Web Token (JWT) is a compact, URL-safe means of representing claims to be transferred between two parties.
  2. [2]
    Get Started with JSON Web Tokens - Auth0
    Single Sign On is a feature that widely uses JWT nowadays, because of its small overhead and its ability to be easily used among systems of different domains.
  3. [3]
    [PDF] JSON Web Token (JWT) - IETF
    May 12, 2012 · Network Working Group. M. Jones. Internet-Draft. Microsoft. Intended ... Public draft published before November 2010 IIW based upon the JSON token.
  4. [4]
    draft-jones-json-web-token-00 - IETF Datatracker
    Dec 28, 2010 · 1. The JWT MUST contain two period characters. · 2. The JWT MUST be split on the two period characters resulting in three non-empty segments. · 3.Missing: history | Show results with:history
  5. [5]
    RFC 7519 - JSON Web Token (JWT) - IETF Datatracker
    Apr 4, 2025 · JSON Web Token (JWT) (RFC 7519, May 2015)
  6. [6]
    RFC Errata Report » RFC Editor
    RFC 7519, "JSON Web Token (JWT)", May 2015. Note: This RFC has been updated by RFC 7797, RFC 8725 · Source of RFC: oauth (sec). Errata ID: 5906
  7. [7]
    RFC 8725 - JSON Web Token Best Current Practices
    This Best Current Practices document updates RFC 7519 to provide actionable guidance leading to secure implementation and deployment of JWTs.Missing: Working contributors
  8. [8]
    RFC 9068 - JSON Web Token (JWT) Profile for OAuth 2.0 Access ...
    This specification defines a profile for issuing OAuth 2.0 access tokens in JSON Web Token (JWT) format.
  9. [9]
  10. [10]
  11. [11]
  12. [12]
  13. [13]
  14. [14]
    RFC 7515 - JSON Web Signature (JWS) - IETF Datatracker
    JSON Web Signature (JWS) represents content secured with digital signatures or Message Authentication Codes (MACs) using JSON-based data structures.
  15. [15]
  16. [16]
    JSON Web Token (JWT)
    ### Summary of Public Claims Registered in IANA for JWT
  17. [17]
  18. [18]
  19. [19]
  20. [20]
  21. [21]
  22. [22]
  23. [23]
    JSON Web Tokens - Auth0
    JSON web token (JWT), pronounced “jot”, is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information ...
  24. [24]
    Token Based Authentication Made Easy - Auth0
    Token based authentication works by ensuring that each request to a server is accompanied by a signed token which the server verifies for authenticity.
  25. [25]
    JWT Security Best Practices | Curity
    Jul 23, 2024 · It's a standard, defined in RFC 7519. The ... The JWT's header can contain claims that are used in the process of signature verification.1. Jwts Used As Access... · 3. Jwt Signing And... · 10. How To Work With Jwt...
  26. [26]
    Algorithm confusion attacks | Web Security Academy - PortSwigger
    Algorithm confusion attacks (also known as key confusion attacks) occur when an attacker is able to force the server to verify the signature of a JSON web token ...
  27. [27]
    Critical vulnerabilities in JSON Web Token libraries - Auth0
    Meet the "None" Algorithm. The none algorithm is a curious addition to JWT. It is intended to be used for situations where the integrity of the token has ...
  28. [28]
    Testing JSON Web Tokens - WSTG - Latest | OWASP Foundation
    One of the most serious vulnerabilities encountered with JWTs is when the application fails to validate that the signature is correct. This usually occurs when ...
  29. [29]
    Lab: JWT authentication bypass via kid header path traversal
    This lab uses a JWT-based mechanism for handling sessions. In order to verify the signature, the server uses the kid parameter in JWT header to fetch the ...
  30. [30]
    JWT: Vulnerabilities, Attacks & Security Best Practices - Vaadata
    Apr 30, 2025 · The JOSE header of a JWT contains two key parameters: alg and typ . The alg parameter indicates the signing algorithm used, while typ specifies ...How Does A Jwt Work? · What Is Jwt? · Jwt Structure And Generation
  31. [31]
    JSON Web Token Best Current Practices
    ### Summary of Security Considerations and Common Pitfalls from draft-ietf-oauth-jwt-bcp-07
  32. [32]
    Security Issue in JWT Secret Poisoning (Updated)
    Jan 9, 2023 · Researchers discovered a new vulnerability in the popular JsonWebToken open source project. The vulnerability is identified as CVE-2022-23529, rated high ...Executive Summary · Jwt 101 · The Vulnerability...
  33. [33]
    Lab: JWT authentication bypass via flawed signature verification
    This lab uses a JWT-based mechanism for handling sessions. The server is insecurely configured to accept unsigned JWTs.
  34. [34]
  35. [35]
  36. [36]
  37. [37]
    JSON Web Token for Java - OWASP Cheat Sheet Series
    This cheatsheet provides tips to prevent common security issues when using JSON Web Tokens (JWT) with Java.
  38. [38]
    REST Security - OWASP Cheat Sheet Series
    Secure REST services must only provide HTTPS endpoints. This protects authentication credentials in transit, for example passwords, API keys or JSON Web Tokens.Introduction · JWT · Input validation · Validate content types
  39. [39]
  40. [40]
    RFC 7517 - JSON Web Key (JWK) - IETF Datatracker
    A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key.
  41. [41]
  42. [42]
  43. [43]
    Awesome JSON Web Token (JWT) Awesome - GitHub
    A curated list of awesome libraries and resources about JSON Web Token (JWT), a standard JSON structure, compact, URL-safe means of representing properties.
  44. [44]
    JOSE + JWT library for Java - Connect2id
    May 28, 2025 · This library implements the Javascript Object Signing and Encryption (JOSE) and JSON Web Token (JWT) standards, with a comprehensive yet easy to use API.Examples · JWE with shared key · JOSE / JWT parsing · Validating access tokens
  45. [45]
  46. [46]
    Configure JWT bearer authentication in ASP.NET Core
    Sep 29, 2025 · Learn how to set up JWT bearer authentication in an ASP.NET Core app.Missing: Express. js, Spring
  47. [47]
    Keats/jsonwebtoken: JWT lib in rust - GitHub
    This library automatically validates the exp claim, and nbf is validated if present. You can also validate the sub, iss, and aud but those require setting the ...
  48. [48]
    golang-jwt/jwt: Go implementation of JSON Web Tokens (JWT).
    A go (or 'golang' for search engine friendliness) implementation of JSON Web Tokens. Starting with v4.0.0 this project adds Go module support.
  49. [49]
    jwt package - github.com/golang-jwt/jwt/v5 - Go Packages
    Jul 30, 2025 · A go (or 'golang' for search engine friendliness) implementation of JSON Web Tokens. Starting with v4.0.0 this project adds Go module support.