Skip to content

Two-Factor Authentication

EaseLab supports time-based one-time passwords (TOTP) compatible with Google Authenticator, Microsoft Authenticator, Authy, and similar apps. Recovery codes provide backup access when the authenticator is unavailable.

Who should enable 2FA?

RoleRecommendation
Tenant ownerRequired for production labs
Lab administratorsStrongly recommended
Reception / techniciansOptional; enable for shared workstations
Platform adminsStrongly recommended

Enabling 2FA

Authenticated users manage 2FA under Account Settings or via the API:

StepEndpointDescription
1. Check statusGET /me/2faReturns enabled and recovery code count
2. Start setupPOST /me/2fa/setupReturns QR code URI and shared secret
3. ConfirmPOST /me/2fa/enableBody: { "code": "123456" } — returns recovery codes
4. DisablePOST /me/2fa/disableRequires current TOTP or recovery code

WARNING

Store recovery codes securely. They are shown once during setup and cannot be retrieved later without disabling and re-enabling 2FA.

Login with 2FA

When 2FA is enabled, POST /auth/login returns:

json
{ "requiresTwoFactor": true, "userId": "..." }

Complete sign-in with POST /auth/verify-2fa:

FieldRequiredNotes
userIdYesFrom login response
codeYes*6-digit TOTP code
recoveryCodeYes*Alternative to TOTP

*Provide either code or recoveryCode, not both.

On success, access and refresh tokens are issued the same as a normal login.

Recovery codes

  • Generated when 2FA is first enabled.
  • Each code is single-use.
  • Using a recovery code does not disable 2FA.
  • If all codes are lost, a tenant admin or platform operator must assist with account recovery.

Platform admin 2FA

Platform admin accounts support the same TOTP flow. Platform admin user records expose twoFactorEnabled in the admin user list.

Security properties

PropertyDetail
AlgorithmTOTP (RFC 6238)
WindowStandard time step with clock skew tolerance
Brute-force protectionAuth endpoints are rate-limited
Session binding2FA challenge is tied to userId from initial login

Troubleshooting

SymptomSolution
Code always invalidCheck device time sync (NTP)
Lost phoneUse a recovery code
Lost phone and codesContact platform support or tenant admin
2FA loop on loginClear cookies; ensure correct portal URL

See Troubleshooting: Login for more access issues.

Ease Lab — Cloud Pathology Lab Management