Skip to main content

devise_two_factor_authentication

👤 Two-Factor Auth with Devise and ROTOTP​

Add 2FA by integrating devise-two-factor or rotp. Store encrypted TOTP secrets and verify codes on sign-in.

gem 'devise-two-factor'
# app/models/user.rb
devise :two_factor_authenticatable,
otp_secret_encryption_key: Rails.application.credentials.otp_key