How to Install and Configure Two Factor Authentication on Magento 2

How to Install and Configure Two Factor Authentication on Magento 2

How to Install and Configure Two Factor Authentication on Magento 2

Two months ago, Magento rolled out the Two Factor Authentication technology to boost the overall security system. It has been designed to protect the stores from being hacked. In fact, even if the hacker manages to get your login credentials, it will be impossible to intrude your website due to the application of the extra security layer. In this article, you will know the process of installing and configuring the Two Factor Authentication system. Now, let’s dive in.

Installing Two Factor Authentication on Magento 2

There are two ways of installing the new security system. The first one is using SSH Terminal. The second one is using plugins, like Two-Factor Authentication extension from Aitoc and Xtento. In this tutorial, we will perform the installation with SSH terminal. However, keep in mind that the method is unlikely to work on shared Magento web hosting, as it utilizes the composer.

Installing Two Factor Authentication Using SSH Terminal

  1. Open SSH terminal.
  2. Connect your website.
  3. Head to the root directory. Run this command:
composerrequire msp/twofactorauth:3.0.0
  1. Use this line to activate Two Factor Authentication module:
php bin/magento module:enable --all
  1. Type this line to upgrade the setup:
php bin/magento setup:upgrade
  1. Use this command to compile the setup:
php bin/magento setup:di:compile
  1. Clean the cache.
phpbin/magento cache:clean
  1. Finally, flush the cache to complete the installation process
php bin/magento cache:flush

Configuring Two Factor Authentication on Magento 2

You can configure Two Factor Authentications using four types of authenticators. They are:

  • Google Authenticator
  • U2F devices
  • Duo Security
  • Authy

In this tutorial, we will configure Google Authenticator, which is the most popular option.

Configuring Google Authenticator

  1. Log in to the Magento 2 admin panel.
  2. Head to Stores > Configuration.

  1. Expand Security.
  2. Click on 2FA.

  1. Now, expand the General section. In Force providers option, select Google Authenticator.

  1. Expand Google Authenticator section. To active, select Yes. In Enable “trust this device” option, select No. It will force the users to enter the authentication code every time they sign in to your store. If you want to do just the opposite, select Yes.

  1. Finally, click on the Save Config button to complete the configuration.

Testing Two Factor Authentication on Magento 2

Now, it’s time for checking whether the Two Factor Authentication is working properly or not on your store. Just follow these steps:

  1. Install the Google Authenticator app on your smartphone.
  2. Log out and log in to your Magento 2 admin panel. You will be asked to scan a QR code during the sign in attempt.

  1. Scan the code with the authentication app that you have installed in the first step. You will be provided with a code. Insert it in the Authenticator code field in Magento 2. Finally, click on the Confirm button.

If you manage to get into the admin panel without any issue, then you have implemented the Two Factor Authentication on your Magento 2 store successfully.

Conclusion

In this article, you have learned the way of installing Two Factor Authentication with SSH Terminal. You have also learned to configure it and check its functionality with the Google Authenticator mobile app. Now, the store has become highly secured. The hackers will have a very hard time intruding your website.

Check out these top 3 Magento hosting services:

Kamatera
$4.00 /mo
Starting price
Visit Kamatera
Rating based on expert review
  • User Friendly
    3.5
  • Support
    3.0
  • Features
    3.9
  • Reliability
    4.0
  • Pricing
    4.3
Hostinger
$2.99 /mo
Starting price
Visit Hostinger
Rating based on expert review
  • User Friendly
    4.7
  • Support
    4.7
  • Features
    4.8
  • Reliability
    4.8
  • Pricing
    4.7
FastComet
$1.79 /mo
Starting price
Visit FastComet
Rating based on expert review
  • User Friendly
    4.7
  • Support
    5.0
  • Features
    4.8
  • Reliability
    4.5
  • Pricing
    5.0

How to Enable Two-Factor Authentication on an Ubuntu 18.04 VPS or Dedicated Server

This guide will show you how you enable two-factor authentication to improve the
4 min read
Max Ostryzhko
Max Ostryzhko
Senior Web Developer, HostAdvice CTO

How to use Magento 2 CMS

This tutorial is written to help you use Magento 2 Content Management System (CM
3 min read
Michael Levanduski
Michael Levanduski
Expert Hosting Writer & Tester

How To Upload A File To An FTP Server Via Coding in Magento?

This guide will help you use codes to upload a file to an FTP server in Magento
2 min read
Idan Cohen
Idan Cohen
Marketing Expert

How to Setup UPS Carrier in Your Magento 2 store

This tutorial will help you configure the United Parcel Service carrier in your
3 min read
Marin Dujic
Senior Writer & Hosting Expert
HostAdvice.com provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.
Click to go to the top of the page
Go To Top