Magento 2.4.0 2 factor authentication issue

Hi

So after fumbling through the new version of Magento 2.4 installation on digitalOcean.

ive hit a wall…after installing everything and then trying to log into the admin area i get the following message.

"You need to configure Two-Factor Authorization in order to proceed to your store’s admin area

An E-mail was sent to you with further instructions"

So I need to be able able to set the DO server to send emails.

Any suggestions on how I set this up?

Thanks

Paul

You see why I haven’t put out a video yet. I raised this issue with Magento a couple of weeks ago: https://github.com/magento/magento2/issues/29312

I don’t expect an official solution/answer for a while.

Totally - a strange requirement just for installation.

Yeah, this is totally unclear from Adobe.
One solution is to, as you said, install a smtp server. I did however solve this in two different ways which both worked for me.

  • Solution 1 Install Mark Shust module for disabling 2fa (really not recommended, but works).
  • Solution 2 Install a smtp module, i used Mageplazas Smtp-module and then configured it through bin/magento to use mailtrap
  • Solution 3 Another way would be to follow David Alger’s guide here docs.warden.dev/environments/initializing.html search for 2fa on that page.
  • Does require python and some other tools but pretty basic.
  • Solution 4 =D Just do “bin/magento module:disable Magento_TwoFactorAuth”, but like said before, not recommended, especially not in production.
1 Like

So, having done this during the Live Stream, we worked out that you can get a very rudimentary SMTP service working on your Web Server by following these steps.

1. Install Postfix (I left all options as default values)

sudo apt install mailutils

2. Open postfix config file

sudo nano /etc/postfix/main.cf

3. Replace the following

inet_interfaces = all

with

inet_interfaces = loopback-only

4. Save your changes and Close the nano editor by pressing:

Ctrl+X to exit, Y to save and Enter to confirm.

5. Restart Postfix for changes to take affect

sudo systemctl restart postfix

Notes

  • Your 2FA email will go to your SPAM when you refresh the Magento backend login page
  • These steps are the bare minimum required to send out an email. There is much more to configure if you plan to use SMTP in a Production Environment
  • Thank you to those who spotted the typo during the stream to get this working :+1:
  • I believe adding SMTP capability to your web server is the preferred method that Magento want you to use because it doesn’t involve disabling 2FA at any point
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.