Appearance
Multi-Factor Authentication (MFA) Guide
Overview
Multi-Factor Authentication (MFA), also known as Two-Factor Authentication (2FA), adds an extra layer of security to your account by requiring a second verification step in addition to your password.
Why Use MFA?
MFA significantly improves account security by:
- Protecting against password theft: Even if your password is compromised, attackers cannot access your account without the second factor
- Meeting compliance requirements: Many security standards (SOC 2, GDPR) recommend or require MFA for sensitive accounts
- Admin account protection: Especially important for administrators who have access to platform-wide data
Supported Methods
TOTP (Time-based One-Time Password)
Recommended Method
Uses authenticator apps to generate time-based codes:
- Apps Supported: Google Authenticator, Microsoft Authenticator, Authy, 1Password, and other TOTP-compatible apps
- How It Works: Generates a new 6-digit code every 30 seconds
- Advantages:
- No phone number required
- Works offline
- More secure (not vulnerable to SIM swapping)
- Industry standard (RFC 6238)
SMS
Receive verification codes via text message:
- Requirements: Phone number in E.164 format (e.g., +14165551234)
- System Requirements: System phone number must be configured by administrator
- How It Works: Receives a 6-digit code via SMS (valid for 10 minutes)
- Rate Limiting: Maximum 3 codes per 15 minutes per user
Enrollment Process
TOTP Enrollment
- Navigate to Profile → Security Settings
- Click Enable MFA → Use Authenticator App
- Scan the QR code with your authenticator app
- Alternative: Enter the manual entry key if you can't scan
- Enter the 6-digit code from your app to verify
- Save your backup codes (shown only once)
- MFA is now enabled
SMS Enrollment
- Navigate to Profile → Security Settings
- Click Enable MFA → Use SMS
- Enter your phone number in E.164 format (e.g., +14165551234)
- Click Send Verification Code
- Enter the 6-digit code received via SMS
- Save your backup codes (shown only once)
- MFA is now enabled
Backup Codes
What Are Backup Codes?
Backup codes are one-time use codes that allow you to access your account if you lose access to your MFA device.
Important Notes
- 10 codes generated when you enable MFA
- One-time use only - each code can only be used once
- Cannot be retrieved after enrollment (they're hashed before storage)
- Download or copy during enrollment - this is your only chance to see them
- Regenerate if needed - you can generate new codes (this invalidates old ones)
Using Backup Codes
- During login, if you can't access your MFA device
- Check the "Use backup code instead" option
- Enter one of your saved backup codes
- The code will be consumed and cannot be used again
Regenerating Backup Codes
- Navigate to Profile → Security Settings
- Enter your password
- Click Regenerate Backup Codes
- Save the new codes - old codes are now invalid
Login Flow with MFA
Standard Login (No MFA)
- Enter email and password
- Access granted immediately
Login with MFA Enabled
- Enter email and password
- System detects MFA is enabled
- Prompted for verification code
- Enter code from:
- Authenticator app (TOTP)
- SMS message
- Backup code
- Access granted after successful verification
Managing MFA
View MFA Status
Check your MFA status in Profile → Security Settings:
- Enabled/Disabled: Current MFA status
- Method: TOTP or SMS
- Enrolled Date: When MFA was first enabled
- Last Used: Most recent successful MFA verification
Disable MFA
- Navigate to Profile → Security Settings
- Enter your password to confirm
- Click Disable MFA
- MFA is immediately disabled
Security Note: Disabling MFA removes the extra security layer. Only disable if necessary.
Change MFA Method
To switch from SMS to TOTP (or vice versa):
- Disable current MFA (requires password)
- Enable MFA with new method
- Complete enrollment process
Security Features
Rate Limiting
- MFA Verification: Maximum 5 attempts per 15 minutes
- SMS Code Requests: Maximum 3 codes per 15 minutes
- Account Lock: Account may be locked after too many failed attempts
Code Expiration
- SMS Codes: Valid for 10 minutes
- TOTP Codes: Valid for current 30-second window (with 2-window tolerance for clock drift)
- Backup Codes: No expiration (but one-time use only)
Encryption
- TOTP Secrets: Encrypted at rest using AES-256-GCM
- Backup Codes: Hashed before storage (SHA-256)
- Phone Numbers: Stored in database (for SMS MFA)
Troubleshooting
Can't Access Authenticator App
- Use Backup Code: Check the "Use backup code instead" option during login
- Regenerate Codes: If you've lost backup codes, you'll need to disable MFA (requires password) and re-enable
Not Receiving SMS Codes
- Check Phone Number: Verify it's in E.164 format (e.g., +14165551234)
- Check System Phone: Ensure administrator has configured system phone number
- Rate Limiting: Wait 15 minutes if you've requested too many codes
- Contact Support: If issues persist
Lost Backup Codes
- Regenerate: Use the "Regenerate Backup Codes" option (requires password)
- Disable MFA: If you can't access your account, contact support to disable MFA
Clock Sync Issues (TOTP)
- Check Device Time: Ensure your device's clock is synchronized
- Tolerance Window: System allows 2 time-step window (±60 seconds) for clock drift
- Manual Entry: Try entering the code manually if scanning QR code fails
Best Practices
- Enable MFA: Especially important for admin accounts
- Save Backup Codes: Store them securely (password manager, encrypted file)
- Use Authenticator App: More secure than SMS (not vulnerable to SIM swapping)
- Keep Codes Secure: Don't share backup codes or MFA secrets
- Regular Review: Periodically check MFA status and regenerate codes if needed
- Multiple Devices: Consider using a cloud-based authenticator (Authy, 1Password) for backup
Admin Configuration
System Phone Number
For SMS MFA to work, administrators must configure a system phone number:
- Navigate to Admin Settings → General tab
- Find System Phone Number field
- Enter phone number in E.164 format (e.g., +14165551234)
- Save configuration
Fallback: If not configured in admin settings, system uses TELNYX_PHONE_NUMBER environment variable.
API Endpoints
MFA Management
GET /api/auth/mfa/status- Get current MFA statusPOST /api/auth/mfa/enroll/totp- Start TOTP enrollmentPOST /api/auth/mfa/enroll/totp/verify- Complete TOTP enrollmentPOST /api/auth/mfa/enroll/sms- Start SMS enrollmentPOST /api/auth/mfa/enroll/sms/verify- Complete SMS enrollmentPOST /api/auth/mfa/disable- Disable MFA (requires password)POST /api/auth/mfa/regenerate-backup-codes- Generate new backup codes
Login Flow
POST /api/auth/login- ReturnsrequiresMFA: trueif MFA enabledPOST /api/auth/mfa/verify- Verify MFA code during login
Related Documentation
- Profile Management - User profile settings
- Security Practices - Security docs overview
- Password Reset - Password reset functionality

