Set Up TOTP Credentials & Generate 2FA Codes in n8n
Comprehensive guide to extract TOTP secrets from QR codes and set up n8n credentials for generating one-time passcodes matching Google Authenticator for services like OpenAI and GitHub.
This n8n workflow serves as a step-by-step guide to implementing Time-based One-Time Password (TOTP) generation directly within n8n, eliminating the need for mobile authenticator apps like Google Authenticator or Authy. Users start by extracting the otpauth:// link from a 2FA QR code provided by services such as OpenAI, Google, or GitHub using online tools. This link contains the essential secret key and issuer details required for TOTP setup.
Next, the guide walks through creating a dedicated TOTP credential in n8n: input the secret key into the Secret field and the service:username format (e.g., OpenAI:email@example.com) into the Label field, then save it. Finally, activate the workflow's Test mode to instantly generate the current 6-digit TOTP code along with seconds remaining, producing output identical to standard 2FA apps.
Benefits include seamless integration of 2FA into automated n8n workflows, enhanced security without app dependencies, and time savings for developers managing multiple accounts. It's particularly valuable for IT teams handling secure API accesses.
Use cases span security automation, such as dynamically generating codes for scheduled logins to AI services, GitHub CI/CD pipelines requiring 2FA, or HR onboarding processes for employee account setups. This simple yet powerful setup unlocks programmatic 2FA handling in any n8n automation.
New buyers can create an account from the cart to unlock a controlled $10 first-purchase credit on eligible orders of $25+.
Secure checkout powered by Stripe
Support
How to import this workflow into n8n
- 1Purchase or download the workflow to get the n8n workflow JSON file.
- 2In your n8n instance, open Workflows and choose "Import from File" (or paste the JSON with Ctrl+V on the canvas).
- 3Open each node marked with a credential warning and connect your own accounts and API keys.
- 4Run the workflow once manually to verify the data flow, then toggle it to Active.
Related Human Resources workflows
- Automatic Job Listings Extraction and Publishing Template$24.99
- SEO Blog Publishing for Jekyll: GPT-4, GitHub & Social Sharing$24.99
- Scrape Recent Company News from Calendar for Sales Calls$14.99
- Automated GitLab Group to Gitea Org Repo Migration$19.99
- Send SMS/WhatsApp Messages with Twilio$4.99
- Postgres: Create Table and Insert Sample Data$8.99
More from Mateusz Rasmussen
Need this deployed? We'll set it up for you.
Our automation experts deploy this workflow in your stack, connect your accounts, and verify it works — or build a custom solution from scratch.