Add Multi-Factor Authentication (MFA) Support #18481

Closed
opened 2026-02-21 19:48:13 -05:00 by yindo · 0 comments
Owner

Originally created by @k-brahma on GitHub (Sep 28, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

Yes, this addresses a critical security gap. As an enterprise user of Dify, I needed Multi-Factor Authentication for my production deployment to meet security compliance requirements. Since MFA wasn't available in Dify, I had to implement it myself for my own system.

Realizing this is a fundamental security feature that many Dify users would benefit from, I decided to contribute this implementation back to the community.

I've already implemented a complete TOTP-based MFA solution with QR code setup, backup codes, and seamless login integration. The implementation is production-ready and includes comprehensive test coverage.

2. Additional context or comments

Implementation details:

  • TOTP authentication compatible with Google Authenticator, Authy, etc.
  • Secure encrypted storage of MFA secrets
  • Backup codes with proper hashing for account recovery
  • Internationalization framework prepared (translations for key languages, extensible for others)
  • Complete test suite with security-focused tests

Technical approach:

  • Uses industry-standard pyotp library for TOTP implementation
  • QR code generation for easy setup
  • Proper integration with existing login flow
  • Database migration included

This feature is implemented in PR #26329, which is a clean implementation based on the latest main branch.

Note: This supersedes previous attempts (#22455, #26112) that became outdated due to extensive upstream changes over 2 months and so on. The current implementation is focused, clean, and fully compatible with the latest codebase.

3. Can you help us with this feature?

  • I am interested in contributing to this feature.
Originally created by @k-brahma on GitHub (Sep 28, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] Please do not modify this template :) and fill in all the required fields. ### 1. Is this request related to a challenge you're experiencing? Tell me about your story. Yes, this addresses a critical security gap. As an enterprise user of Dify, I needed Multi-Factor Authentication for my production deployment to meet security compliance requirements. Since MFA wasn't available in Dify, I had to implement it myself for my own system. Realizing this is a fundamental security feature that many Dify users would benefit from, I decided to contribute this implementation back to the community. I've already implemented a complete TOTP-based MFA solution with QR code setup, backup codes, and seamless login integration. The implementation is production-ready and includes comprehensive test coverage. ### 2. Additional context or comments Implementation details: - TOTP authentication compatible with Google Authenticator, Authy, etc. - Secure encrypted storage of MFA secrets - Backup codes with proper hashing for account recovery - Internationalization framework prepared (translations for key languages, extensible for others) - Complete test suite with security-focused tests Technical approach: - Uses industry-standard pyotp library for TOTP implementation - QR code generation for easy setup - Proper integration with existing login flow - Database migration included This feature is implemented in PR #26329, which is a clean implementation based on the latest main branch. Note: This supersedes previous attempts (#22455, #26112) that became outdated due to extensive upstream changes over 2 months and so on. The current implementation is focused, clean, and fully compatible with the latest codebase. ### 3. Can you help us with this feature? - [x] I am interested in contributing to this feature.
yindo added the 💪 enhancement label 2026-02-21 19:48:13 -05:00
yindo closed this issue 2026-02-21 19:48:14 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#18481