Demo
General
Authentication

Multi-factor via TOTP

Learn about multi-factor authentication in the monorepo.

Multi-factor authentication (MFA) adds an extra layer of security to your application by requiring users to provide two forms of verification. This is especially useful in safeguarding accounts from unauthorized access.

TOTP

Achromatic's implementation supports TOTP (Time-based One-Time Password), a widely-used standard for MFA. You can use any TOTP-compatible app, such as Google Authenticator, Authy, or Microsoft Authenticator.

How it works

  1. Setup MFA: Users can enable multi-factor authentication in their security settings. A QR code is displayed to scan with a TOTP app. The TOTP app generates a 6-digit code at regular intervals.

  2. Verification: Users must input the code from their TOTP app to complete the setup or to log in.

  3. Recovery Codes: To ensure access if the TOTP app is unavailable, users are provided with recovery codes. Each recovery code is single-use and serves as a backup.

Technical details

Multi-factor authentication in this starter kit is implemented using two additional credentials providers:

  • TOTP Provider: Validates one-time passwords generated by a TOTP app.
  • Recovery Code Provider: Allows authentication using pre-generated backup codes.

This modular approach ensures compatibility with any TOTP-compliant application and offers flexibility for future enhancements.