Validate TOTP token without creating a credential
TOTP Validation with Function Node This template allows you to verify if a 6-digit TOTP code is valid using the corresponding TOTP secret. It can be used in ...
🔌 Nodes & Integrations Used (1)
📖 Implementation & Setup Guide
TOTP Validation with Function Node
This template allows you to verify if a 6-digit TOTP code is valid using the corresponding TOTP secret. It can be used in an authentication system. The inputs need to be: - a base32 totp secret (String) - a 6 digits code (String)
++Important:++ The 6-digit code must be in text format. If the code starts with zeros and is treated as a number, it could cause validation issues.
The function node will generate a 6-digit code from the TOTP secret, then compare it with the provided code. If they match, it will return `1` otherwise, it will return `0`. ## Example usage:
- You retrieve the user's TOTP secret from a database, then you want to verify if the 2FA code provided by the user is valid.
Setup Guidelines You only need the ==`TOTP VALIDATION`== node. ==You will need to modify lines `39` and `40`== of the node with the correct values for your specific context.
Testing the Template You can define a sample secret and code in the `EXAMPLE FIELDS` node of the template, then click `"Test Workflow"`. If the code is valid for the provided secret, the flow will proceed to the `true` branch of the `IF CODE IS VALID` node. Otherwise, it will go to the `false` branch.
⚡ How to import this workflow into n8n:
- Click the Direct Download JSON button above to save
Validate TOTP token _without creating a credential_.json. - Log in to your n8n Cloud or self-hosted n8n instance.
- In your workflow canvas, click the menu in top-right and select Import from File (or paste the JSON directly).
- Configure your credentials (e.g. API keys, database URLs) in the corresponding node settings.
- Click Execute Workflow to test and switch to Active!
Related General Automation Workflows
View All in General Automation →Generate Application Copy
Production-ready n8n automation template for Generate Application Copy built by AhiXLight. Seamlessly connects Execute Workflow Trigger, OpenAI with 4 configured nodes.
2-way sync Google Contacts and Notion
Sync your Google Contacts with your Notion database. You can filter contacts by label or sync all contacts. All contact information is kept in sync between G...
2D Image to 3D Model Automation
Production-ready n8n automation template for 2D Image to 3D Model Automation built by AhiXLight. Seamlessly connects HTTP Request, Google Sheets, Google Drive with 17 configured nodes.
2 way sync assignments completion between Canvas LMS and Notion
Syncs assignments and completion states to and fro between Canvas LMS and a Notion database. Automatically triggers every 2 hours during the schoolday by def...