Overview
This node provides operations to handle JSON Web Tokens (JWTs), specifically focusing on decoding JWT tokens without verifying their signature. The "Decode" operation extracts a JWT token from various sources, decodes it, and returns its payload. This is useful when you want to inspect the contents of a JWT token quickly without validating its authenticity or integrity.
Common scenarios include:
- Debugging or inspecting JWT tokens received from clients or other services.
- Extracting claims from a JWT for conditional logic in workflows.
- Logging or auditing token contents without needing to verify them.
For example, you might receive an HTTP request with a Bearer token in the Authorization header and want to decode it to read user information embedded in the token.
Properties
| Name | Meaning |
|---|---|
| Token Source | Where to extract the JWT token from. Options: Authorization Header, JSON Field, Raw String. |
| Header Name | Name of the header containing the token (used if Token Source is Authorization Header). |
| Field Name | JSON field containing the token (supports dot notation; used if Token Source is JSON Field). |
| Token | Raw JWT token string (used if Token Source is Raw String). |
| Complete | Whether to return the full token details including header and signature along with payload. |
| Pass Through | Whether to pass through the original input data alongside the decoded output. |
Output
The node outputs JSON objects representing the decoded JWT token:
- If Complete option is false (default), the output JSON contains the decoded payload claims as key-value pairs.
- If Complete is true, the output JSON includes:
header: The decoded JWT header.payload: The decoded JWT payload.signature: The signature part of the JWT token.
If Pass Through is enabled (default), the original input JSON data is included under the originalData property in the output.
No binary data is produced by this operation.
Dependencies
- Requires the
joselibrary for JWT decoding. - No external API calls or credentials are needed for decoding.
- No special n8n environment variables or configurations are required.
Troubleshooting
- No token found: This error occurs if the node cannot locate a JWT token based on the selected Token Source and parameters. Check that the token is present in the specified header, JSON field, or raw string input.
- Invalid JWT structure: If the token does not have the expected three parts separated by dots, decoding will fail.
- Ensure that the token string is a valid JWT format (Base64URL encoded segments).
- If using JSON Field extraction, verify the field path is correct and exists in the input data.
- If decoding fails unexpectedly, confirm the token is not malformed or corrupted.