Secure Your Authentication with TOTP Validation
detail.loadingPreview
Automate the verification of Time-based One-Time Password (TOTP) codes with this n8n workflow. Ensure the security of your applications by seamlessly validating 2FA codes.
About This Workflow
This n8n workflow provides a robust solution for validating Time-based One-Time Password (TOTP) codes, commonly used for Two-Factor Authentication (2FA). Leveraging Python code within the n8n environment, it accurately calculates and verifies TOTP codes against their corresponding secret keys. The workflow is designed for easy integration into authentication systems, allowing you to programmatically check the validity of user-provided 2FA codes, thereby enhancing the security posture of your applications. It includes clear setup guidelines and a testing mechanism to ensure smooth implementation.
Key Features
- Automated TOTP Verification: Accurately validates TOTP codes in real-time.
- Python-Powered Logic: Utilizes a secure and efficient Python script for TOTP generation and comparison.
- Conditional Logic: Seamlessly integrates with conditional nodes to route workflows based on validation success.
- Easy Integration: Designed for straightforward incorporation into existing authentication flows.
- Testable Workflow: Includes example fields for quick testing and debugging.
How To Use
- Import the Workflow: Add this n8n workflow snippet to your n8n instance.
- Configure the "TOTP VALIDATION" Node:
- Access the "TOTP VALIDATION" node.
- On lines 39 and 40 of the Python code, replace
_input.item.json.totp_secret_exampleand_input.item.json.code_to_verify_examplewith the actual variables containing the TOTP secret and the code to be verified from your previous nodes.
- Set up "IF CODE IS VALID" Node:
- Ensure the "IF CODE IS VALID" node's condition
={{ $json.status }} === 1is correctly set to check the output from the "TOTP VALIDATION" node.
- Ensure the "IF CODE IS VALID" node's condition
- Connect Nodes: Ensure the "When clicking 'Test workflow'" node is connected to "EXAMPLE FIELDS", and "EXAMPLE FIELDS" is connected to "TOTP VALIDATION", which then connects to "IF CODE IS VALID".
- Test the Workflow: Use the "When clicking 'Test workflow'" trigger and provide sample TOTP secrets and codes in the "EXAMPLE FIELDS" node to verify the logic.
Apps Used
Workflow JSON
{
"id": "217f9f4c-d13d-4f65-be31-64759cc9dacb",
"name": "Secure Your Authentication with TOTP Validation",
"nodes": 6,
"category": "DevOps",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: 217f9f4c-d13d...
About the Author
Free n8n Workflows Official
System Admin
The official repository for verified enterprise-grade workflows.
Statistics
Related Workflows
Discover more workflows you might like
Automate Qualys Report Generation and Retrieval
Streamline your Qualys security reporting by automating the generation and retrieval of reports. This workflow ensures timely access to crucial security data without manual intervention.
Automated PR Merged QA Notifications
Streamline your QA process with this automated workflow that notifies your team upon successful Pull Request merges. Leverage AI and vector stores to enrich notifications and ensure seamless integration into your development pipeline.
Robust Concurrency Control for n8n Workflows with Redis
Prevent simultaneous execution of critical n8n workflows or tasks using a centralized, Redis-backed locking mechanism. This reusable utility workflow ensures data integrity and resource management by allowing other workflows to acquire, check, and release locks.