On this page
- Step 1: Install the module
- Step 2: Set an encryption key (required for production)
- Step 3: Configure the module settings
- General
- One-time code parameters
- User self-service
- Enforcement
- Step 4: Assign permissions
- Step 5: Set up 2FA as a user
- Step 6: Log in with 2FA
- REST / JSON login
- Step 7: Manage users' 2FA (support staff)
Step-by-step configuration
Step 1: Install the module
Install with Composer and enable it with Drush:
composer require drupal/auth_login_plus
drush en auth_login_plusOr enable Authenticator Login Plus under Extend (/admin/modules), in the Security package.
Step 2: Set an encryption key (required for production)
TOTP secrets are encrypted at rest with AES-256-GCM. If no key is set, the module generates one and stores it in Drupal State, which is not guaranteed to survive a site clone or rebuild. For production, generate a key:
php -r "echo base64_encode(random_bytes(32)), PHP_EOL;"Then add it to settings.php:
$settings['auth_login_plus_encryption_key'] = 'PASTE_YOUR_BASE64_32_BYTE_KEY_HERE';Set the key before users enroll, and never change it afterwards. Secrets encrypted with the old key can no longer be read, so every user would have to enroll again. Until a key is set, the Status report page shows a warning.
Step 3: Configure the module settings
Go to Administration » Configuration » People » Authenticator Login Plus (/admin/config/people/auth_login_plus/settings). You need the Administer site configuration permission.

General
- Enable two-factor authentication: global on/off switch. When off, no code is asked for anywhere on the site.
- Use the custom setup page design: uses the module's card-style design on the setup, login challenge and status pages. Turn it off to use plain Drupal form styling from your theme.
- Issuer name: the name shown next to the account in the authenticator app. Leave blank to use the site name.
One-time code parameters
- Code length: 6, 7 or 8 digits (default 6). Most apps expect 6.
- Code validity period (seconds): 15–120 (default 30). Most apps expect 30.
- Clock drift tolerance: how many codes before or after the current one are still accepted, to allow for a small clock difference between the server and the phone (default 1 period).
If you change the code length or period, users who are already enrolled must set up their authenticator again, because their app keeps generating codes with the old values.
User self-service
- Allow users to enable or disable 2FA themselves: shows the Enable 2FA toggle on the user's 2FA page.
- Issue one-time backup codes at enrollment and Number of backup codes to generate (1–20, default 10).
- Allow users to reset 2FA via an emailed link during login: shows a Lost access to your authenticator? link on the login challenge page. The link emails a one-time reset link to the user's address.
- After a successful OTP challenge, redirect to: where the user goes after entering a valid code (by default, the page they were originally going to).
Enforcement
- Force users without 2FA configured to the setup page: makes 2FA required. Logged-in users without 2FA are redirected to the setup page until they enroll, and cannot turn 2FA off.
- Redirect message and Message type: the message shown when a user is redirected.
Click Save configuration.
Step 4: Assign permissions
Go to People » Permissions and filter by Authenticator Login Plus (/admin/people/permissions/module/auth_login_plus).

| Permission | What it allows |
|---|---|
| Manage user 2FA | See every user's 2FA status, and reset, enable or disable their enrollment. Does not give access to the settings form. Give it to a support or helpdesk role. |
| Bypass enforced 2FA redirect | Exempts the user from the forced redirect to the setup page when 2FA is required. Use it sparingly, for example for service accounts. |
Both permissions are marked as restricted. Give them to trusted roles only.
Step 5: Set up 2FA as a user
Each user sets up 2FA on the 2FA tab of their account (/user/{uid}/2fa-plus). The link /user/2fa always goes to the current user's own page. When enforcement is on, users are sent here automatically after logging in.
- Open an authenticator app and scan the QR code. If the camera can't scan it, click Can't scan? Enter it manually and type in the account, issuer and key.
- Enter the 6-digit code shown in the app and click Verify and enable.

After verification, the one-time backup codes are shown. They are shown only once. Each code works once if the user loses their phone, so save them somewhere safe.

On later visits, the page shows the current status and how many backup codes are left. Set up a new authenticator moves 2FA to a new phone. The old authenticator keeps working until the new one is confirmed.

Step 6: Log in with 2FA
After a correct username and password, the user is sent to /2fa/login and asked for a code from their app, or one of their backup codes. The login is completed only after a valid code is entered.

After 10 wrong codes for the same account within 15 minutes, further attempts are blocked for a while. The block clears on its own.
REST / JSON login
For /user/login?_format=json, accounts with 2FA enabled must send the current code as mfa_token in the request body:
{
"name": "jane",
"pass": "secret",
"mfa_token": "123456"
}Too many failed codes returns HTTP 429 with a Retry-After header.
Step 7: Manage users' 2FA (support staff)
Users with the Manage user 2FA permission can go to People » Two-factor authentication (/admin/people/auth_login_plus) to see every user's 2FA status and when it last changed. The list can be filtered by username.

The Operations column has these actions:
- Reset: deletes the user's secret and unused backup codes. The user must set up a new authenticator the next time 2FA is required.
- Disable: stops asking for a code at login but keeps the secret, so 2FA can be turned back on without setting it up again.
- Enable: turns 2FA back on using the existing secret.
Every action asks for confirmation first:

Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion