Anyone, please help me with how to disable the Two-factor Authentication module using a command-line.


  • 4
    just found the module with the help of grep command...this works php bin/magento module:disable Magento_TwoFactorAuth well.... – MageSoftech Jul 31 '20 at 1:45
  • please post this comment as answer – Amit Bera Jul 31 '20 at 4:12
  • Does this answer your question? Magento 2.4 - Two factor authentication – robsch Sep 8 '20 at 7:52

please run below command in terminal Magento root path :

bin/magento module:disable Magento_TwoFactorAuth
bin/magento cache:flush 
  • +1 accepted. ... yes thanks for the answer.. – MageSoftech Jul 31 '20 at 16:33
  • i would not recommend to force disable the module, rather use new module which extend the configuration so there should always be an option to control the configurations from admin panel. – Zeeshan Khuwaja Aug 14 '20 at 4:02
  • @ZeeshanKhuwaja it's useful to disable this in development to avoid having to perform 2FA on your development machine when logging into admin. I wouldn't disable in production as it's a useful security feature. – BugHunterUK Sep 5 '20 at 19:50
  • 1
    Yes, this feature enabled by default is a pain for localhost installation. I would prefer to login without it and then enable this feature from the Admin panel. – Laraveldeep Oct 8 '20 at 19:52
  • 1
    For me, I needed to run "bin/magento setup:di:compile" also – Laraveldeep Oct 8 '20 at 19:56

Mark Shust created a module for this purpose which is developer-friendly while keeping secure defaults in place; ref his comments about it

  • Definitely the better option to use this module than to generally disable 2FA. – codedge Sep 12 '20 at 16:55
  • Thanks @benmarks, the module works really great except the part that it does not work on the REST APIs interface. Seems the patch only works on the admin area not on all areas. – Zeeshan Khuwaja Nov 9 '20 at 6:59

I found a way, by adding a system configuration to Enable/Disable it. I made a module, you can download it with composer:

composer require wolfsellers/module-enabledisabletfa

Or check it at: https://github.com/wolfsellers/module-enabledisabletfa

  • 1
    You have copied same answer to two questions, please do some changes at content to make two answers are different – Amit Bera Aug 6 '20 at 9:08
  • +1 for the additional coverage on the REST and SOAP areas. – Zeeshan Khuwaja Nov 9 '20 at 7:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.