Token analysis & validation tool • 2026 dev
Header.Payload.Signature
Components:
Encoding: Base64Url encoded JSON objects
Example:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
Decoding reveals the JSON claims contained in the token.
| Claim | Value | Type |
|---|
JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. This information can be verified and trusted because it is digitally signed.
Header - Contains token type and signing algorithmPayload - Contains claims (user identity, permissions)Signature - Verifies token integrityiss - Issuersub - Subjectaud - Audienceexp - Expiration timenbf - Not beforeiat - Issued atImportant security practices:
Compact token for secure data transmission.
Header.Payload.Signature
Base64Url encoded JSON objects.
For stateless authentication.
What is the primary purpose of JWT?
The answer is C) To securely transmit information as JSON object. 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 JWS structure or JWE.
JWT stands for JSON Web Token and it's a standard for creating tokens that assert some number of claims. The tokens are signed using a cryptographic algorithm to ensure they haven't been tampered with. JWTs are commonly used for authentication and authorization in web applications.
JWT: JSON Web Token - compact token format
Claims: Statements about an entity (typically user)
JSON: JavaScript Object Notation
• JWTs are compact
• Self-contained
• Digitally signed
• Use for stateless auth
• Verify signatures always
• Check expiration
• Confusing JWT with encryption
• Not verifying signatures
• Ignoring expiration checks
What are the three parts of a JWT separated by dots?
A JWT consists of three parts separated by dots:
Structure: Header.Payload.Signature
Each part of the JWT is Base64Url encoded. The header and payload are JSON objects that are encoded, while the signature is created by combining the encoded header and payload with a secret and applying the specified algorithm. This structure allows for both verification of integrity and inspection of contents.
Header: Metadata about token (alg, typ)
Payload: Claims (user data, permissions)
Signature: Verification mechanism
• Always 3 parts
• Separated by dots
• Base64Url encoded
• Header contains alg and typ
• Payload contains claims
• Signature verifies integrity
• Forgetting the 3-part structure
• Confusing order of parts
• Not understanding Base64Url encoding
Which of the following are registered claims in JWT? Select all that apply: iss, sub, aud, exp, nbf, iat, jti, custom_claim
The registered claims in JWT are:
iss (Issuer) - Identifies principal that issued the JWTsub (Subject) - Identifies subject of the JWTaud (Audience) - Identifies recipients that the JWT is intended forexp (Expiration Time) - Defines time after which the JWT expiresnbf (Not Before) - Defines time before which the JWT must not be acceptediat (Issued At) - Time at which the JWT was issuedjti (JWT ID) - Unique identifier for the JWTcustom_claim is not a registered claim - it's a public or private claim defined by the application.
Registered claims are predefined claim names that are commonly used and understood by the JWT ecosystem. They are not mandatory but have agreed-upon meanings. Public claims are defined by the application, and private claims are agreed upon between parties without collision risk.
Registered Claims: Predefined claim names (iss, sub, aud, etc.)
Public Claims: Application-defined claims
Private Claims: Agreed-upon custom claims
• Registered claims have standard meanings
• Use registered claims when possible
• Avoid collisions with registered names
• Remember: ISS, SUB, AUD, EXP, NBF, IAT, JTI
• Always check exp and iat
• Verify aud matches expected value
• Not understanding claim types
• Forgetting to validate required claims
• Using reserved names for custom claims
A developer stores sensitive user information (like social security number) in a JWT payload. What security issue does this create and why?
Storing sensitive information in a JWT payload creates a security vulnerability because:
The correct approach is to store only non-sensitive information in JWTs, such as user ID, roles, and permissions. Sensitive data should be stored server-side and referenced by the token if needed.
This is a common misconception about JWT security. The signature only ensures integrity and authenticity, but does not provide confidentiality. The payload is always readable by anyone who has the token, regardless of whether it's signed or not.
Integrity: Ensuring data hasn't been tampered with
Confidentiality: Ensuring data is not readable by unauthorized parties
Authentication: Verifying identity of token issuer
• JWTs provide integrity, not confidentiality
• Never store sensitive data in payloads
• Use for identification, not sensitive data
• Store user ID, not personal details
• Use server-side session storage for sensitive data
• Treat JWTs as publicly readable
• Assuming JWTs are encrypted
• Storing sensitive data in payloads
• Not understanding the difference between integrity and confidentiality
Which algorithm is considered more secure for JWT signing?
The answer is C) RS256 (RSA with SHA-256) or D) ES256 (ECDSA with SHA-256). Both RS256 and ES256 are asymmetric algorithms that provide better security for certain use cases. RS256 is widely used and well-supported. While HS256 is secure when implemented correctly, asymmetric algorithms provide advantages for distributed systems where the public key can be shared freely while keeping the private key secure.
HS256 is symmetric (same key for signing and verification), while RS256 and ES256 are asymmetric (different keys for signing and verification). Asymmetric algorithms allow for better key management in distributed systems since the public key can be shared without compromising security.
Symmetric: Same key for signing and verification
Asymmetric: Different keys for signing and verification
RSA: Rivest-Shamir-Adleman cryptographic algorithm
• Never use "none" algorithm in production
• Prefer asymmetric for distributed systems
• Always keep secrets secure
• Use RS256 for distributed systems
• HS256 for simpler applications
• Never expose private keys
• Using "none" algorithm in production
• Hardcoding secrets in code
• Not rotating signing keys
Q: Can JWTs be encrypted to protect the payload?
A: Yes, JWTs can be encrypted using JWE (JSON Web Encryption). A regular JWT (JWS - JSON Web Signature) is only signed, not encrypted. An encrypted JWT (JWE) would have five parts: protected_header.encrypted_key.iv.ciphertext.authentication_tag. However, JWEs are more complex to implement and are less commonly used than signed JWTs.
For most applications, if you need to protect sensitive data, it's better to store only non-sensitive information in the JWT and keep sensitive data server-side.
Q: How do I handle JWT token revocation since they are stateless?
A: JWT revocation is indeed challenging since tokens are self-contained. Common approaches include:
The most effective approach is usually to use short-lived access tokens (15-30 minutes) with longer-lived refresh tokens that can be properly managed server-side.