Option 1:
Please configure SMTP in your local system to send/receive email notification and after setup 2FA.
SMTP Extension for Magento 2
Option 2:
Temporary workaround to setup 2FA without having SMTP:
- navigate to /admin and log in
- you should see the 2FA screen now
- add
var_dump($url);die;
on line 86 (function sendConfigRequired) in vendor/magento/module-two-factor-auth/Model/EmailUserNotifier.php
- refresh /admin
- copy the URL that is displayed
- remove the var_dump
- use the URL copied earlier to navigate to the 2FA setup
Option 3:
Temporary disable TwoFactorAuth module using following command(for dev environment):
php bin/magento module:disable Magento_TwoFactorAuth
php bin/magento cache:flush
Option 4:
Install the following module to enable/disable two-factor authentication from backend:
DisableTwoFactorAuth