ModernUUID Icon ModernUUID
Module 05 / Web Crypto Subtle Engine

Online JWT Studio & Interactive Debugger

Decode JSON Web Tokens with live claims date parsing, validate HMAC-SHA256 signatures entirely inside browser memory, and generate newly signed tokens on the fly.

Valid Structure
1. Decoded Header (Algorithm & Token Type)
 
2. Decoded Payload (Data & Claims)
 
3. Interactive Claims Inspector
RFC 7519 SECURITY ARCHITECTURE

Comprehensive Guide to JSON Web Tokens (JWT): Anatomy, Security & Verification

Standard Reference: IETF RFC 7519 (JSON Web Token) & RFC 7515 (JSON Web Signature)

The Tripartite Anatomy of a JSON Web Token

A standard JSON Web Token consists of three Base64URL-encoded strings concatenated by periods (header.payload.signature):

1. Header (Metadata)

Specifies token type ("typ": "JWT") and the cryptographic signing algorithm (e.g., "alg": "HS256" or "RS256").

2. Payload (Claims)

Encapsulates registered statements (sub, iss, exp, iat) alongside application-specific user permissions and roles.

3. Cryptographic Signature

Calculated by hashing Base64URL(header) + "." + Base64URL(payload) with the secret key to guarantee message integrity.

Critical Security Best Practices & Vulnerability Prevention

🛡️ The "alg": "none" Exploit

Flawed verification libraries may accept tokens where the header specifies "alg": "none", treating un-signed tokens as verified! Always hardcode permitted algorithms (e.g. whitelist strictly ['HS256']) on your backend verification handlers.

🔒 HttpOnly Cookies vs LocalStorage

Storing JWTs in browser localStorage exposes sessions to Cross-Site Scripting (XSS) credential theft. Always store sensitive bearer JWTs in HttpOnly, Secure, SameSite=Strict cookies.

Developer FAQ & Technical Reference

Frequently Asked Questions

Deep technical explanations covering identifier architecture, token security, cryptographic hashing, and zero-backend client execution.

JWT (JSON Web Tokens) & Auth

RFC 7519 Security
01. What is a JWT token, what does JWT stand for, and how does JWT work? +

JWT stands for JSON Web Token (pronounced "jot"), an industry standard defined under RFC 7519 for securely representing claims between two interacting parties as a compact, self-contained JSON object.

A JWT consists of three Base64URL-encoded strings separated by periods: Header.Payload.Signature.

  • Header: Specifies the metadata, including the token type and cryptographic signature or encryption cipher algorithm (such as HMAC SHA-256 or RSA/ECDSA).
  • Payload (Claims): Encapsulates domain-specific user assertions, permissions, and standard security timestamps (including sub for subject, iat for issued-at, and exp for expiration time).
  • Signature: A cryptographic evaluation generated by hashing the Header and Payload together using a private server secret or private key, preventing data tampering in transit.

On Modern UUID, our specialized client-side JWT engine parses, decodes, and validates these cryptographic signatures entirely within your browser sandbox—zero token strings or validation secrets are ever transmitted across external network sockets.

02. What is the difference between JWT authentication and authorization? +

While frequently interconnected within application security workflows, authentication and authorization enforce two structurally distinct security requirements:

  • Authentication (AuthN - "Who are you?"): The protocol of validating identity credentials. For example, verifying a submitted email and password combination against a database, and subsequently issuing an immutable, cryptographically signed JWT to represent that validated session.
  • Authorization (AuthZ - "What can you do?"): The verification of resource access privileges and action permissions. When an authenticated client transmits a JWT to an API gateway, the backend verifies the signature and parses internal authorization claims (e.g., "role": "admin" or "scopes": ["write:orders"]) before permitting route execution.

Because JWTs encapsulate validated authorization claims directly within the signed token body, backend microservices can execute stateless authorization verification locally without querying a relational database on every subsequent HTTP request.

03. What is an access token vs refresh token in token authentication? +

Modern OAuth2 and OIDC application security architectures mandate a dual-token strategy to balance seamless UX session continuity with rigorous defensive threat containment:

  • Access Token: A short-lived cryptographic credential (typically expiring between 15 minutes and 1 hour) transmitted inside network authorization request headers (Authorization: Bearer <token>) to gain immediate access to protected resource endpoints.
  • Refresh Token: A long-lived, securely sequestered cryptographic secret (lasting several days or months) utilized strictly to request a brand new Access Token from an identity authorization server whenever the prior access token naturally expires.

This separation minimizes attack surface vulnerability: if an in-memory access token is accidentally exfiltrated via network interception, its short expiry renders it useless within minutes. Meanwhile, long-lived refresh tokens remain safely quarantined in hardened vaults where they can be explicitly revoked by server admins.

04. Where should I store JWT tokens on the frontend: LocalStorage vs HTTP-only cookies? +

HTTP-only, Secure Cookies represent the architectural defense-in-depth standard for web client browser token persistence.

  • HTTP-only Cookies: Completely immune to Cross-Site Scripting (XSS) exfiltration attempts because standard DOM JavaScript cannot read, parse, or transmit cookie payloads via the document.cookie interface. Combining HTTP-only flags with SameSite=Strict configurations simultaneously eliminates Cross-Site Request Forgery (CSRF) vulnerability vectors.
  • LocalStorage & SessionStorage: Critically vulnerable to XSS exploitation. If a compromised third-party NPM dependency or malformed script injection executes within the application DOM, attackers can execute trivial harvesting routines via localStorage.getItem() to siphon active JWT session credentials to remote exfiltration servers.

Universal Best Practice: Store sensitive authentication tokens in HTTP-only, Secure, SameSite cookies for traditional web clients, and utilize transient in-memory state or OS native keychain vaults when engineering mobile web views or desktop wrappers.

05. Can a JWT be decrypted or read without the secret key? +

Yes, immediately and trivially. Standard JSON Web Tokens are cryptographically signed to prove authorship and prevent structural modification, but they are almost never encrypted.

The structural Header and Payload sections of a conventional JWT are simply transformed into textual readability using standard Base64URL encoding. Any user, intermediate proxy, or network observer who intercepts a standard JWT can instantly run Base64 decoding routines (using tools like Modern UUID's local client-side JWT decoder) to inspect every embedded user ID, email address, role assertion, and payload variable without possessing the server signing secret.

Critical Security Imperative: Never embed confidential credentials, database passwords, secret keys, or unencrypted personally identifiable information (PII) inside a standard JWT payload. If payload privacy across public channels is strictly required, implement JWE (JSON Web Encryption) protocols.

06. How do you invalidate or revoke a stateless JWT token? +

Because standard JWTs are architecturally stateless—meaning receiving servers verify token legitimacy purely via mathematical signature verification and expiration checking—a remote backend cannot inherently "delete" an issued JWT prior to its natural expiration timestamp (exp claim) without introducing targeted verification logic. Approved engineering patterns include:

  • Aggressive Short-Lived Expirations: Maintain access token TTL lifespans under 10 to 15 minutes, relying on rapid natural expiration to limit access persistence upon session termination.
  • Token Blacklisting (Denylisting): Persist revoked token unique identifiers (the jti claim) within an ultra-fast in-memory cache architecture (such as a Redis cluster) until their timestamp naturally expires. Every incoming API request verifies absence from the denylist.
  • Token Versioning (Generation Counters): Store an integer token generation counter (tv claim) within both the user database record and the signed JWT payload. When a user explicitly signs out or executes an emergency password reset, increment the database version counter—causing all legacy tokens carrying outdated numerical assertions to fail validation instantly.

Ready to execute these cryptographic utilities locally?

Run multi-format UUID generators, JWT decoders, Bcrypt hashers, and Token synthesis engines inside your browser sandbox—zero server latency, total anti-interception privacy.