Two-Factor Authentication
Two-factor authentication (2FA) adds an extra layer of security to the sign-in process. After entering valid credentials, users must complete a second verification step before gaining access to the platform. This protects accounts even if a password is compromised.
Supported verification methods
Section titled “Supported verification methods”ThingsBoard supports four verification methods. Each can be enabled or disabled independently by administrators:
| Method | Description |
|---|---|
| Authenticator app (TOTP) | A time-based one-time password (TOTP) generated by an external app such as Google Authenticator, Authy, or Duo Mobile. No network access required to generate codes. |
| A one-time verification code is sent to the user’s registered email address after entering valid credentials. Requires a configured mail server. | |
| SMS | A one-time verification code is sent to the user’s phone number via SMS. Requires an SMS provider integration. |
| Backup codes | Single-use 8-character codes generated by the user and stored offline (downloaded or printed). Can only be used alongside at least one other enabled 2FA method. |
Administrative configuration
Section titled “Administrative configuration”System administrators configure 2FA settings through Security → Two-factor authentication.
Enabling verification methods
Section titled “Enabling verification methods”Enable the methods you want to make available to users. For each enabled method you can configure:
- Verification code lifetime — how long a generated code remains valid before it expires (configurable in seconds, minutes, or hours).
- Total allowed time for verification — the maximum time window within which a user must complete 2FA verification after entering their password.
- Retry verification code period — the minimum delay between code resend attempts.
- Max verification failures before user lockout — how many failed code attempts are allowed before the user is temporarily locked out.
- Verification code check rate limit — limits the number of code verification attempts within a given time window to prevent brute-force attacks.
For Email and SMS methods, you can also customize the verification message template used to deliver codes.
After configuring the settings, click Save to apply.
Tenant-level override
Section titled Tenant-level overrideBy default, tenant administrators inherit the system-wide 2FA settings. To configure custom settings for a specific tenant:
- As a tenant administrator, open Security → Two-factor authentication in the left sidebar.
- Uncheck Use system two factor auth settings.
- Configure the desired methods and parameters.
- Click Save.
User configuration
Section titled “User configuration”Users enable and manage their 2FA methods through Account → Security.
Setting up an authenticator app
Section titled “Setting up an authenticator app”- Navigate to Account → Security and find the Two-factor authentication section.
- Toggle the Authenticator app switch to open the setup dialog.
- In the Verification step, scan the displayed QR code with your authenticator app (Google Authenticator, Authy, Duo Mobile, etc.), or enter the 32-digit key manually.
- Enter the 6-digit code generated by your app in the field provided.
- Click Next to confirm, then click Done on the success screen.
Setting up email verification
Section titled “Setting up email verification”- Navigate to Account → Security.
- Toggle the Email switch to open the setup dialog.
- Enter or confirm the email address where codes will be sent.
- Click Send code.
- Enter the 6-digit code received in your email.
- Click Next to confirm, then click Done on the success screen.
Setting up SMS verification
Section titled “Setting up SMS verification”- Navigate to Account → Security.
- Toggle the SMS switch to open the setup dialog.
- Enter your phone number in E.164 format (e.g., +12015550123).
- Click Send code.
- Enter the 6-digit code received via SMS.
- Click Next to confirm, then click Done on the success screen.
Setting up backup codes
Section titled “Setting up backup codes”- Navigate to Account → Security.
- Toggle the Backup code switch to open the dialog.
- Review the generated backup codes.
- Click Download (txt) or Print to save the codes securely.
- Click Done to finish.
Sign-in with 2FA
Section titled “Sign-in with 2FA”After entering a valid username and password, users with 2FA configured are prompted for a verification code:
- Enter your username and password on the login page, then click Sign in.
- On the Verification screen, enter the code from your configured method. If multiple methods are set up, you can switch between them.
- Click Verify to complete sign-in.
To use backup codes instead, click Try another way on the verification screen and enter an 8-character backup code.