TOTP 2-factor authentication (TfaTotp)

TOTP standards for “Time-based One-Time Password”, which is an algorithm that computes a one-time password. It does this with a shared secret key and the current time.

TOTP is implemented by many mobile authenticator applications, and thus widely available and in widespread use. TOTP is supported by all of these authenticator applications (and likely others), which you can use with ProcessWire:

  • Google Authenticator (Android, iOS)
  • Microsoft Authenticator (Android, iOS)
  • 1Password (Android, iOS, Windows, Mac)
  • Authy (Android, iOS, Windows, Mac, cloud-sync)
  • LastPass Authenticator (Android, iOS, Windows, Mac, Linux, cloud-sync)

One of the nice things about TOTP is that all the applications implement the same algorithm (described in RFC 6238), and thus there is likely to be broad compatibility between them.

TOTP relies upon a long string of characters called a "secret", which is a private key that is stored server-side with the user account when enabling two-factor auth. When you use your phone and authenticator app to scan a QR code, it is sharing that secret with your phone. From that point forward, the website and phone can confirm identity with a 6-digit code that changes every 30 seconds.

What if your phone dies or gets lost? Since the private key (secret) is stored on your phone, you'd no longer have the ability to generate authentication codes. So this could be a problem, unless you've got a backup of your private key. Applications like Authy and LastPass keep that backup for you (cloud-sync). If you are using another application like Google Authenticator, you could always keep your own backup of the QR code/secret, so that you could plug it into any other phone or authentication app and continue to generate codes with it. But if you were to do that, you'd want to do so very securely, as the more copies of that secret that there are, the less secure it is.

To use TOTP two-factor authentication in ProcessWire, you must be running version 3.0.109 or newer, and you must install the TfaTotp module (link below).

Latest news

  • ProcessWire Weekly #552
    In the 552nd issue of ProcessWire Weekly we'll check out the latest weekly update from Ryan, take a quick look at a new e-commerce solution for ProcessWire, and more. Read on!
    Weekly.pw / 7 December 2024
  • Custom Fields Module
    This week we look at a new ProFields module named Custom Fields. This module provides a way to rapidly build out ProcessWire fields that contain any number of subfields/properties within them.
    Blog / 30 August 2024
  • Subscribe to weekly ProcessWire news

“To Drupal, or to ProcessWire? The million dollar choice. We decided to make an early switch to PW. And in retrospect, ProcessWire was probably the best decision we made. Thanks are due to ProcessWire and the amazing system and set of modules that are in place.” —Unni Krishnan, Founder of PigtailPundits