BlocksTokens & Crypto
Generate Token
Create a secure, random string for authentication or identification.
The Generate Token block allows you to create a customizable, random string. This is commonly used for generating session IDs, API keys, password reset tokens, or unique identifiers.
Configuration
| Field | Required | Description |
|---|---|---|
| Token Length | ✅ | The number of characters for the generated token (6 to 365). |
| Token Charset | ✅ | Choose the characters to include: numbers, lowercase, uppercase, and symbols. |
| Token Variable | ✅ | The name of the variable that will store the generated token (e.g., session_token). |
Security Tip
For high-security tokens like API keys, use a length of at least 32 characters and include all charsets.
Error Handling
GENERATE_TOKEN_LENGTH_INVALID— Triggered when the length is not between 6 and 365.GENERATE_TOKEN_CHARSET_INVALID— Triggered when no character set is selected.GENERATE_TOKEN_VARIABLE_INVALID— Triggered when the output variable name is missing.GENERATE_TOKEN_RUNTIME_ERROR— Triggered if an unexpected error occurs during generation.
Example: Creating a Password Reset Token
When a user requests a password reset, you can generate a secure 48-character token to include in their reset link.
- Token Length: Set to
48. - Token Charset: Select
numbers,lowercase, anduppercase. - Token Variable: Enter
reset_token. - Result: The variable
{reset_token}now contains a value like8k2mN9PqL1vX7zW....
You can then save this {reset_token} to your database and send it to the user via email.
