Maxim Mironjuk
-
April 06, 2026
Magento 2 has shipped a solid, native two-factor module for several versions, but it exclusively protects the admin area. No comparable built-in solution exists for customer accounts, even though stores with saved payment data, store credit balances, or sensitive B2B order data have a legitimate interest in additionally securing the storefront login. This article shows how to wire a custom TOTP-based two-factor authentication for customer accounts cleanly into the existing authentication flow, including the UX trade-off between mandatory and opt-in, plus a well thought out recovery code concept.