🔥 Just Launched! Werra Premium Template for HyväSee it in Action

How to Setup Two Factor Authentication in Magento 2.4

By Sanjay JethvaUpdated on May 22, 2025 3 min read

Did you check the latest Magento 2.4 release yet?

Are you excited to implement the new features that can boost the store’s performance and security?

Well, we are!

And as a part of it, here’s the method to set up two factor authentication in Magento 2.4.

Earlier, Magento 2 did offer an option to install two-factor authentication. The store owner can enable or disable the Magento 2 2FA as per the requirements. However, it is not best practice to disable Magento 2FA.

However, according to Magento 2.4 release notes, 2FA is enabled by default and cannot be disabled.

It is done so to make it harder for the spam users to log in to the admin panel without authority.

Security cannot be neglected when it comes to the online store and hence check the method to configure two-factor authentication in Magento 2.4 store.

Note: While installing the latest Magento 2.4 version, if you face the Unexpected ‘)’  syntax error.

Steps to setup two factor authentication in Magento 2.4:

Magento 2 2FA

1. Login to admin panel

2. Navigate to Stores > Configuration

3. Select 2FA under Security

4. Expand General section

5. Select the providers to use. You can also select multiple providers

  • Google Authenticator
  • Duo Security
  • Authy
  • U2F (Yubikey and others)

6. Save the configuration

That’s it.

Once configured, the 2FA is prompted as shown below:

Google Authenticator:

Google Auth

Duo Authentication:

Duo Auth

Authy authentication:

Authy

U2F authentication:

u2f auth

(Image Source – Magento Docs)

You can also refer to the video tutorial to set up two-factor authentication in Magento 2.4 from our Magento 2 video tutorial series:

Secure your Magento 2 admin panel with two-factor authentication using the latestMagento 2.4.3!

Also, share the solution with the Magento community via social media.

Thank you.

Sanjay Jethva Full Image
Article bySanjay Jethva

Sanjay is the co-founder and CTO of Meetanshi with hands-on expertise with Magento since 2011. He specializes in complex development, integrations, extensions, and customizations. Sanjay is one the top 50 contributor to the Magento community and is recognized by Adobe. His passion for Magento 2 and Shopify solutions has made him a trusted source for businesses seeking to optimize their online stores. He loves sharing technical solutions related to Magento 2 & Shopify.