0CodeKit icon

0CodeKit

A toolbox of no-code utilities

Actions114

Generate → Decode JSON Web Token

AI-generated

Overview

This node operation decodes a JSON Web Token (JWT). It can optionally verify the token's signature using a provided secret. This is useful in scenarios where you need to extract the payload data from a JWT for authentication, authorization, or data exchange purposes. For example, decoding a JWT received from a client to validate user identity or extract claims.

Use Case Examples

  1. Decoding a JWT to read user information embedded in the token.
  2. Verifying a JWT's signature to ensure it has not been tampered with before processing its payload.

Properties

Name Meaning
Code Variables Allows defining multiple code variables with names and values to be used in the code editor for the selected function.
Token The JWT string that needs to be decoded.
Verify Boolean flag indicating whether to verify the token's signature.
Secret Secret key used to verify the token's signature if verification is enabled.
Options Additional options for decoding the token, provided as a string.

Output

JSON

  • decodedToken - The decoded JWT payload and header information after decoding (and optionally verifying) the token.

Dependencies

  • An API key credential for the CodeKit API

Troubleshooting

  • If the token is invalid or malformed, the node may throw an error during decoding. Ensure the token string is correctly formatted as a JWT.
  • If verification is enabled but the secret is incorrect or missing, the verification will fail and an error will be thrown. Provide the correct secret key for verification.
  • Incorrect or malformed options string may cause decoding to fail. Ensure options are correctly formatted as expected by the underlying decoding library.

Links

  • JWT Introduction - General information about JSON Web Tokens and their structure.
  • jsonwebtoken Library - Popular Node.js library for decoding and verifying JWTs, likely used by the node internally.

Discussion