How do I set up two-factor authentication in Magento?

Setting up Two-Factor Authentication (2FA) in Magento 2.4.7 is a straightforward process. Here are the steps to enable and configure 2FA:

Step 1: Ensure Two-Factor Authentication is Enabled

Magento 2.4.7 has Two-Factor Authentication enabled by default. However, you should verify this setting.

  1. Log in to Your Magento Admin Panel:

    • Navigate to your Magento admin URL and log in with your admin credentials.
  2. Check 2FA Status:

    • Go to Stores > Configuration > Security > Two Factor Auth.
    • Ensure that "Enable" is set to "Yes".

Step 2: Configure Two-Factor Authentication Providers

Magento supports several 2FA providers, including Google Authenticator, Duo Security, Authy, and U2F keys. Here, we'll focus on setting up Google Authenticator as an example.

  1. Go to 2FA Configuration:

    • Navigate to Stores > Configuration > Security > Two Factor Auth.
  2. Select and Configure Providers:

    • Under the "Providers" section, you can choose which 2FA methods you want to enable. For Google Authenticator:
      • Ensure "Google Authenticator" is selected.
      • Configure any additional settings, such as enabling for specific user roles or email notifications.

Step 3: Set Up 2FA for Admin Users

  1. Log Out and Log In:

    • Log out of the Magento admin panel.
    • Log back in with your admin credentials.
  2. 2FA Setup Prompt:

    • Upon logging in, you will be prompted to set up 2FA for your account.
    • Follow the instructions to set up 2FA with Google Authenticator:
      • Open the Google Authenticator app on your mobile device.
      • Scan the QR code displayed on the Magento login page.
      • Enter the verification code generated by the app.
  3. Complete Verification:

    • Complete the verification process to link your 2FA method with your admin account.

Step 4: Enforce 2FA for All Admin Users

  1. Enforce 2FA:

    • Navigate to Stores > Configuration > Security > Two Factor Auth.
    • Ensure that "Force Providers" is set to the desired 2FA provider for all admin roles.
  2. User Configuration:

    • Ensure all admin users set up their 2FA when they log in.


  • Verify 2FA is enabled in Magento 2.4.7.
  • Configure your preferred 2FA providers.
  • Prompt admin users to set up 2FA upon login.
  • Enforce 2FA for all admin users.