n8n icon indicating copy to clipboard operation
n8n copied to clipboard

Two-Factor Authentication Not Working After Update

Open Polonco opened this issue 2 weeks ago • 2 comments

Bug Description

I have self-hosted n8n using Docker, and starting today, two-factor authentication (2FA) has stopped working. I had to disable it via the command line to regain access. When I tried to re-enable it, I kept getting the following error message: "Two-factor code failed. Please try again."

I never had this issue with previous versions of n8n. I only noticed the problem today, a few days after updating my Docker to the latest n8n version. Additionally, the recovery codes I had saved when I first enabled 2FA no longer worked either.

To Reproduce

  1. Update n8n (self-hosted via Docker) to the latest version.
  2. Log in using two-factor authentication.
  3. Enter the correct 2FA code from an authenticator app.
  4. Observe the error message: "Two-factor code failed. Please try again."
  5. Try using recovery codes—none of them work.
  6. Disable 2FA via the command line to regain access.
  7. Attempt to re-enable 2FA and enter the new code—still fails with the same error.

Expected behavior

2FA to work properly

Operating System

Ubuntu Linux 22.04

n8n Version

1.78.0

Node.js Version

18.16.0

Database

SQLite (default)

Execution mode

main (default)

Polonco avatar Feb 13 '25 13:02 Polonco