Skip to main content

Complete guide to setting up and generating TOTP codes in n8n ๐Ÿ”

Workflow preview

Workflow preview
100%
Complete guide to setting up and generating TOTP codes in n8n ๐Ÿ” preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Setting Up and Generating TOTP Step 1: Receive QR Code and Extract the Link 1. Receive the QR Code from the 2FA service After enabling two factor authentication (2FA) on services like OpenAI, Googl...

Best for

  • SecOps automation workflows
  • beginner n8n builders looking for reusable templates

Tools used

n8n-nodes-base.manualtrigger, n8n-nodes-base.totp

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by AmirHossein MnasouriZade.

Original n8n.io source

1.1 Workflow description

Title
Complete guide to setting up and generating TOTP codes in n8n ๐Ÿ”
Workflow name
Complete guide to setting up and generating TOTP codes in n8n ๐Ÿ”

Setting Up and Generating TOTP

Step 1: Receive QR Code and Extract the Link

1. Receive the QR Code from the 2FA service After enabling two-factor authentication (2FA) on services like OpenAI, Google, GitHub, etc., a QR Code will be given to you, which you need to scan. This QR Code contains the TOTP link used to generate one-time passcodes.

2. Extract the link from the received QR Code To extract the link from the QR Code, use online tools. These tools will help you extract the corresponding link.

After using an online tool, the extracted link will appear in the following format:

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

For example:

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

Step 2: Create TOTP Credential in n8n

  1. Create a new Credential To use TOTP in n8n, you need to create a new TOTP Credential.

  2. Enter the details in the Credential

  • In the Secret field: Enter the secret key (extracted from the QR Code link). For example:
 test-test-test
  • In the Label field: Enter ServiceName:username For example:
OpenAI:[email protected]

  1. Save the Credential After entering the information, click Save to save the Credential.

Step 3: Get the TOTP Code

Click on Test Workflow After setting up the credentials in n8n, click on Test, and the corresponding code will be delivered to you.

Output:

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

==This code is exactly the same as the one generated by apps and services like Google Authenticator or Authy. ๐Ÿ”==

Contact me on [Telegram]: https://t.me/amir676080

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - When clicking โ€˜Test workflowโ€™

Type / Role
n8n-nodes-base.manualTrigger - manualTrigger
Config choices
Version 1

Block 2 - TOTP

Type / Role
n8n-nodes-base.totp - totp
Config choices
Version 1

3. Summary Table

Workflow Complete guide to setting up and generating TOTP codes in n8n ๐Ÿ”
Complexity beginner
Nodes 2
Categories SecOps
Author AmirHossein MnasouriZade
Published 04 Jan 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/2696/2696.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Complete guide to setting up and generating TOTP codes in n8n ๐Ÿ” do?

Setting Up and Generating TOTP Step 1: Receive QR Code and Extract the Link 1. Receive the QR Code from the 2FA service After enabling two factor authentication (2FA) on services like OpenAI, Googl...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your SecOps use case.