Files
wekan/docs/Features/Login-Page/Two-Factor-Authentication.md
T
Lauri Ojansivu 74717ea829 Docs: Login Page: what each feature is, how to use it, how its numbers are calculated, how it works, and its commits.
OAuth2, OAuth providers, SAML, SQRL, Windows SSO, passkeys, two-factor,
passwordless, session cookies, password hashing, autologin, multitenancy,
Nextcloud, Oracle, Zitadel and the Let's Encrypt setup, each in the same
order, checked against the code. Corrected where the code had moved on:
passwordless codes are 10 characters for 15 minutes and are not counted by
the lockout; an OAuth2 login merges an existing account only when enabled
and the email is verified; the Admin Panel sections are under People; the
two-factor entry is hidden only on Sandstorm and for OAuth2 accounts; the
Zitadel example no longer turns on B2C; Rocket.Chat's claim is
preferred_username.

Thanks to xet7 !
2026-11-22 18:05:22 +02:00

6.9 KiB

Two-Factor Authentication (TOTP)

What it is

Opt-in per-user two-factor authentication (TOTP - the same standard used by Google Authenticator, Authy, etc.), added for #3058. After the password, signing in also asks for a 6-digit code from an authenticator app, so a stolen password alone is not enough. An administrator can also make it compulsory with REQUIRE_2FA. It is built on Meteor's official accounts-2fa package - WeKan only draws the QR code and enable/disable buttons; the secret generation and code verification is done by Meteor itself.

Read more

How to use it

Click your avatar/name → Two-Factor Authentication, in the member menu (Member Settings).

┌ (your avatar) ▾ ─────────────┐
│ Change Settings              │
│ Change Color                 │
│ Notifications                │
│ Change Font                  │
│ Change Avatar                │
│ Change Password              │
│ ▸ Two-Factor Authentication  │  <- here
│ Hidden boards, Passkeys, ... │
│ Change Language              │
└─────────────────────────────────┘

┌ Two-Factor Authentication ───────────┐
│  Scan this QR code with your         │
│  authenticator app:                  │
│   ┌───────────┐                      │
│   │ ▓▓  ▓  ▓▓ │                      │
│   │ ▓ ▓▓▓▓ ▓  │   or enter manually: │
│   │ ▓▓  ▓  ▓▓ │   ABCD-EFGH-1234     │
│   └───────────┘                      │
│  Code: [______]  [Confirm] [Cancel]  │
└─────────────────────────────────────────┘

Turn it on

  1. Open your member menu and click Two-Factor Authentication.
  2. Click Enable Two-Factor Authentication to start activation.
  3. Scan the shown QR code with an authenticator app (Google Authenticator, Authy, etc.), or type the manual-entry secret shown under it ("Or enter this code manually") into the app by hand.
  4. Enter the 6-digit code the app now generates into Enter your 6-digit authentication code and click Confirm and Enable.
  5. Once confirmed, the popup shows "Two-factor authentication is enabled for your account." and a Disable Two-Factor Authentication button; from then on, logging in also asks for a 6-digit code.

Sign in with it: after the user name and password, the sign-in page asks Enter your 6-digit authentication code; type it and click Verify.

Make it compulsory (administrator): Admin Panel / People / Login, or the environment variable REQUIRE_2FA = off (default), admins or all. A covered account without 2FA can still sign in, but sees only "Set up two-factor authentication" until it has done so, and cannot switch it off again while it is required.

Prerequisites:

  • An authenticator app on a phone/device able to scan a QR code or accept a manual TOTP secret.
  • Not available when logged in via Sandstorm, and the menu entry is hidden for OAuth2/OIDC accounts (Google/Azure/OIDC/etc. logins manage their own second factor, if any). Meteor asks for the code only on a password login, so for LDAP, SAML and CAS accounts it has no effect either, and REQUIRE_2FA covers only accounts that sign in with a WeKan password. (The old text said the entry appears only for password accounts; the code hides it only on Sandstorm and for authenticationMethod oauth2.)

How the numbers are calculated

  • 6 digits: the code fields accept at most 6 digits; the code is the standard TOTP value, computed and checked by accounts-2fa from the shared secret and the current time.
  • REQUIRE_2FA: off unless the value is exactly admins or all (case-insensitive); admins covers accounts with isAdmin: true (models/lib/twoFactorRequirement.js).
  • An account "has 2FA" when services.twoFactorAuthentication has a secret and type: 'otp', the same test accounts-2fa makes.

How it works in WeKan

Integration tests

See local login protocol tests for example identities, actual request/response checks, failure cases and deployment limitations.

Commits