Who is this workflow for? This guide provides a comprehensive walkthrough for setting up and generating Time-based One-Time Password (TOTP) codes using n8n. By following these steps, you can enhance the security of your workflows with two-factor authentication (2FA)..

What does this workflow do?

  • Receive the QR Code from the 2FA ServiceAfter enabling two-factor authentication (2FA) on services such as OpenAI, Google, GitHub, etc., you will receive a QR Code. This QR Code encodes the TOTP link necessary for generating one-time passcodes.

  • Extract the Link from the QR CodeUse an online QR Code decoder tool to extract the TOTP link from the received QR Code. The extracted link typically follows this format:

   otpauth://totp/ServiceName:username?secret=secret_key&issuer=ServiceName

Example:

   otpauth://totp/OpenAI:[email protected]?secret=test-test-test&issuer=OpenAI

Step 2: Create TOTP Credential in n8n

  • Create a New CredentialIn n8n, navigate to the Credentials section and create a new TOTP Credential.

  • Enter the Credential Details

  • Secret: Input the secret key extracted from the QR Code link (e.g., test-test-test).

  • Label: Enter a descriptive label in the format ServiceName:username (e.g., OpenAI:[email protected]).

    Credential Setup

  • Save the CredentialAfter entering the necessary information, click Save to store the credential securely in n8n.

Step 3: Generate the TOTP Code

  • Test the WorkflowWith the TOTP credential configured, execute a test workflow in n8n by clicking on Test Workflow. This action will generate a TOTP code.

  • Retrieve the TOTP CodeThe output will display the generated TOTP code along with the remaining validity period:

   [     {       "token": "720769",       "secondsRemaining": 18     }   ]

TOTP Code

Note: The generated code is identical to those produced by authenticator apps like Google Authenticator or Authy.

This workflow integrates seamlessly with various platforms and services, including:

  • Facebook
  • Instagram
  • HTTP Request
  • Merge
  • Google Sheets
  • Microsoft Excel
  • Gmail
  • S3
  • Respond to Webhook
  • Webhook
  • Telegram

🤖 Why Use This Automation Workflow?

Implementing TOTP in n8n adds an extra layer of security to your automated workflows. This workflow ensures that sensitive operations are protected by dynamic, time-sensitive codes, reducing the risk of unauthorized access.

👨‍💻 Who is This Workflow For?

This workflow is ideal for developers, automation specialists, and IT professionals who utilize n8n for creating automated processes and seek to strengthen their security measures through two-factor authentication.

🎯 Use Cases

  1. Secure API Integrations: Protect API endpoints by requiring TOTP codes for access, ensuring that only authorized requests are processed.
  2. Automated Credential Management: Automatically generate and update TOTP credentials for various services, streamlining the management of 2FA.
  3. Enhanced Workflow Security: Incorporate TOTP verification steps within complex workflows to secure sensitive data transactions and operations.

TL;DR

By following this guide, you have successfully set up and generated TOTP codes within n8n, enhancing the security of your automated workflows. Implementing this workflow ensures that your processes are protected with robust two-factor authentication, safeguarding your operations against unauthorized access.

For further assistance or queries, feel free to reach out on Telegram.

Help us find the best n8n templates

About

A curated directory of the best n8n templates for workflow automations.