Magento 2 - Enable Two-Factor Authentication (2FA)

Magento 2 - Enable Two-Factor Authentication (2FA)

Since Magento 2 v-2.4.3, it is possible to setup Two-Factor authentication for admin users.
This article will explain how to setup it from Magento side, and make sure the connection with myFulfillment still works once enabled.


Overview

To handle two-factor authentication, Magento have integrated a new module since version 2.4.3.
This module name is "Magento_TwoFactorAuth".
First, you need to check if this module is already installed and enabled in your Magento 2 instance, then you setup to configure an authentication provider to make it work.


2FA module installation

The first step of Magento 2 Two-Factor Authentication configuration consists in making sure the "Magento_TwoFactorAuth" module is correctly installed and enabled.

To check if the module is already installed and enabled, run the folowing command :
php bin/magento module:enable Magento_TwoFactorAuth
  1. If the result of this command line is "No modules were changed." : That means the module is already installed and enabled. In this case, you can go to the next "Configuration" section.
  2. If the result of the command line is "The following modules have been enabled: - BoostMyShop_Magento_TwoFactorAuth" : That means the module was already installed and has been enabled. In this case, you can go to the next "Configuration" section.
  3. If the result of the command line is "Unknown module(s): 'Magento_TwoFactorAuth' " : That means the required module "Magento_TwoFactorAuth" is not installed at all.
If the module is already installed and enabled in your Magento 2 instance, you should be able to see in "Stores > Configuration > Security" the "2FA" section :


If the "Magento_TwoFactorAuth" module is not yet installed in your Magento 2 instance, here is the process to install it :
  1. Go to Magento 2 "Security packages" github repository : https://github.com/magento/security-package
  2. Click on "Code", then on "Download ZIP" :
  3. Extract files from the ZIP folder downloaded
  4. Among files extracted, find the "TwoFactorAuth" folder :
  5. Upload this folder on your Magento 2 server, in directory "app/code/Magento/"
  6. Run Magento 2 modules installation command lines
The module should now be correctly installed and enabled.
You can check it from Configuration section > Security tab, as explained belo


2FA module configuration

Once the Two-Factor Authentication module has been installed, a few settings need to be configured to make it work.
Magento has already well documented the configuration and use of identity providers through the "Magento_TwoFactorAuth" module.
Here a the link to the official Magento 2 guide for 2FA setup : https://docs.magento.com/user-guide/stores/security-two-factor-authentication.html
Following this guide, you should be able to setup correctly your identity provider and make it work for backend users auth.


Final check

Once previous steps have been completed, 2FA should be correctly setup and already working for backend users authentication.
Now, you need to make sure that enabling it didn't break the connection between myFulfillment and your Magento 2 instance.
In order to do so :
  1. Log into your myFulfillment account
  2. Open your Magento 2 integration (Integrations > [Select your Magento 2 integration in the grid])
  3. Click on "Save" in the footer. If an error message is displayed, that means the connection between myFulfillment and your Magento 2 instance is broken.
    In this case, disable the 2FA from Magento side to fix the connection, and contact us.
  4. If the "Save" action didn't display any error message, you need to run a feed to make sure everything still work correctly.
    Go to the "Feeds" tab, and run the "Product synchronization" or "Order synchronization" feed.
    Then, go to the "Feed history" tab, and check the result of the feed once it has run.
    If no error are throw during the process, that means the connection between myFulfillment and your Magento 2 instance works correctly
    If some errors are thrown, that means the connection between myFulfillment and your Magento 2 instance don't work correctly. In this case, disable the 2FA from Magento side to fix the connection, and contact us.

    • Related Articles

    • Magento 1 - Order comments import

      Magento 1 - Order comments import Importing order comments from Magento 1 to MyFullfillment is possible. Comments are imported in MyFullfillment ONLY when the order is imported.  We will not import comments in MyFullfillment after the Order has been ...
    • Magento 2 - Order comments import

      Magento 2 - Order comments import Importing order comments from Magento 2 to MyFullfillment is possible. Comments are imported in MyFullfillment ONLY when the order is imported.  We will not import comments in MyFullfillment after the Order has been ...
    • Magento 2 - Import data from Embedded ERP Magento 2

      This article explains how to export suppliers from ERP Magento2 and import them into Connect Suppliers To export suppliers from Magento2, run the following query : SELECT sup_created_at, sup_updated_at, sup_name, if(sup_code, sup_code, sup_name) as ...
    • Magento 2 - Connect your instance to myFulfillment

      Overview The integration between Connect and Magento 2 will : import products and orders from Magento to Connect Send shipping confirmation and stock updates to Magento. When you integrate Connect with a Magento 2 website, you must keep in mind the ...
    • Magento 2 - MSI Integration

      Overview Magento2 MSI Integration allows to synchronise a warehouse with a Magento2 MSI Source. To get more information about Magento2 Multi Source Inventory, visit the magento website Prerequire-sites You need a working Magento2 integration before. ...