Kling Token Generator icon

Kling Token Generator

Generate JWT token for Kling API

Overview

This node generates a JWT (JSON Web Token) for the Kling API using provided access and secret keys. It is useful in scenarios where you need to authenticate requests to the Kling API by generating valid tokens dynamically within an n8n workflow. For example, before making API calls to Kling services that require JWT authentication, this node can produce the necessary token based on your credentials.

Properties

Name Meaning
Access Key The access key used to generate the JWT token. Required string input.
Secret Key The secret key used alongside the access key to generate the JWT token. This is a password-type input and required.

Output

The node outputs JSON data with the following structure:

{
  "token": "string"
}
  • token: The generated JWT token string that can be used for authenticating requests to the Kling API.

There is no binary output from this node.

Dependencies

  • Requires the presence of a token generation function (generateToken) which takes the access key and secret key as inputs and returns a JWT token.
  • No external API calls are made by this node itself; it only generates tokens locally.
  • Users must provide valid access and secret keys for token generation.

Troubleshooting

  • Missing or invalid keys: If either the access key or secret key is missing or incorrect, the generated token may be invalid or unusable by the Kling API.
  • Token generation errors: If the underlying token generation function fails (e.g., due to malformed keys), the node might throw an error or output an invalid token. Ensure keys are correctly formatted.
  • Empty output: If no input items are provided, the node will not generate any tokens.

Links and References

Discussion