Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Opensolr Search 4.5.0 Minor update available for module opensolr_search (4.5.0). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Two-factor Authentication (TFA)

14,729 sites Security covered Drupal 8–11 TFA ecosystem
View on drupal.org

This module adds a second layer of security to your Drupal site by requiring two-factor authentication for logins. It supports various authentication methods like time-based one-time passwords and SMS codes, and can integrate with third-party services.

Two-factor authentication for Drupal sites. Drupal provides authentication via something you know -- a username and password while TFA module adds a second step of authentication with a check for something you have -- such as a code sent to (or generated by) your mobile phone.

TFA is a base module for providing two-factor authentication for your Drupal site. As a base module, TFA handles the work of integrating with Drupal, providing flexible and well tested interfaces to enable your choice of various two-factor authentication solutions like Time-based One-Time Passwords (TOTP), SMS-delivered codes, pre-generated codes, or integrations with third-party services like Authy, Duo and others.

Read the TFA module documentation or read more about the theory of two-factor authentication in my Drupal Watchdog article.

This module is useful for achieving compliance with PCI DSS requirement 8.3.1:

Incorporate multi-factor authentication for all non-console access into the CDE for personnel with administrative access.

Features

  • Pluggable - Supports multiple methods of two-factor authentication and can work with any number of 3rd party systems
  • Configurable - Supports fallback methods and context-specific exceptions
  • Flood control protection for secures one-time logins
  • Role-based availability and requirement of second factor authentication

TFA module is recommended as a full suite solution for two-factor authentication and Drupal. The following TOTP plugins work with FreeOTP, Google Authenticator, Authy, and any other app that works with TOTP tokens.

Drupal 8 recommended TOTP plugin

The module supports plugins from other modules, but provides its own plugins for:

  • TOTP - Time-based One-Time Passwords - normally used by various Authenticator apps from Google, Microsoft, Authy, etc.
  • HOTP - HMAC-based One-Time Passwords - supported by most of the same apps, but not as popular

Requirements

This module stores some sensitive data which it encrypts using the PHP OpenSSL extension. You will need to have the OpenSSL extension installed to use the module. Legacy installs of the module can take advantage of the Mcrypt extension.

Release Series

Drupal 7

All release series for Drupal 7 are fully unsupported. There will be no future releases, sites should upgrade to Drupal 8 as soon as possible.

Upgrading to a Drupal 8 Release:
Site owners may wish to consider the TFA Migration module.

8.x-1.x

Compatible with Drupal 8.8.0+. Known limitations that 3rd party contrib modules may bypass protection. See Contrib modules can lead to TFA being bypassed

2.x

Not for install production or per-production sites. Install only in development labs to assist in developing the next major release of TFA. Subject to significant design changes without BC.

Warning: Releases of 2.0.0-* have known security vulnerabilities and should not be installed on production sites. See the Roadmap for 2.0.0 release for current status of security vulnerabilities and other important issues.

TFA, Testing, and Development

It can be hard to test user authentication in automated tests with the TFA
module enabled. Development environments also will likely struggle to login
unless they disable TFA or reset the secrets for an account. One solution is
to disable the module in the development and testing environment. To quickly
disable the module you can run these drush commands to set some config:

  • Disable TFA with drush config-set tfa.settings enabled 0
  • Enable TFA with drush config-set tfa.settings enabled 1

Depends on

Dependencies of the latest stable release

Required by

4 tracked projects depend on this one

Activity

Tracked releases
9
Tracked since
Oct 2024
Latest release
9 months ago
Releases (12 mo)
1 ▼ from 8
Maintenance
Slowing

Release Timeline

Releases

Version Type Core Release date
2.0.0-alpha5 Pre-release 10–11 Nov 13, 2025
8.x-1.12 Stable 8–11 Jul 18, 2025
8.x-1.11 Stable 8–11 Jul 2, 2025
8.x-1.10 Stable 8–11 Mar 5, 2025
2.0.0-alpha4 Pre-release 10–11 Nov 30, 2024
2.0.0-alpha3 Pre-release 10–11 Nov 29, 2024
8.x-1.9 Stable 8–11 Oct 17, 2024
7.x-2.4 Stable Oct 2, 2024
8.x-1.8 Stable 8–10 Oct 2, 2024