Decoupled Drupal with 2FA | Configure 2FA with Headless/ Decoupled Drupal


Secure your Headless/Decoupled Drupal with a robust Two Factor Authentication (2FA) using our Drupal Two Factor Authentication - 2FA / Passwordless Login. This guide will help you to configure Two-Factor Authentication (2FA / MFA) for your Headless Drupal site.
Drupal 2FA module will add a second layer of authentication to your Drupal account to increase the security of your site from unwanted hacks and unauthorized login attempts. This module is compatible with all Drupal 7, 8 and Drupal 9 sites.
If you have any queries or if you need any sort of assistance in configuring the module, you can contact us at drupalsupport@xecurify.com. If you want, we can also schedule an online meeting to help you configure the Two Factor Authentication - 2FA / Passwordless Login module.


Pre-requisite: Download and Installation 


  • For Window:
    composer require drupal/miniorange_2fa
  • For Linux:
    composer require 'drupal/miniorange_2fa'
  • Go to Extend menu on your Drupal admin console and enable the module by checking the checkbox and click on Install button.
  • Configure the module at
    {BaseURL}/admin/config/people/miniorange_2fa/customer_setup
  • Download the module:
    drush dl miniorange_2fa
  • Install the module:
    drush en miniorange_2fa
  • Clear the cache:
     drush cr
  • Configure the module at
    {BaseURL}/admin/config/people/miniorange_2fa/customer_setup
  • Navigate to Extend menu on your Drupal admin console and click on Install new module.
  • Install the Drupal Two Factor Authentication / Passwordless login module either by downloading the zip or from the URL of the package (tar/zip).
  • Click on Enable newly added modules.
  • Enable this module by checking the checkbox and click on Install button.
  • Configure the module at
    {BaseURL}/admin/config/people/miniorange_2fa/customer_setup

Steps to configure 2FA method with Headless Drupal using Two Factor Authentication - 2FA / Passwordless Login module:

1. Setup Drupal as Headless 2FA

  • Navigate to the Headless 2FA Setup tab.
  • Click on Enable Headless Two-Factor checkbox to activate the Headless/Decoupled 2FA service.
  • Drupal Headless 2FA - Enable headless 2FA
  • Select the authentication method of your choice from 2FA method dropdown.
  • Drupal Headless 2FA - Select 2FA Method
  • Enter the Machine Name of the phone number field. You can click the link in Note to check available fields on your Drupal site.
  • Drupal Headless 2FA Enter Machine Name
  • Click on the Save Settings button.

2. Steps to integrate Headless/ Decoupled 2FA:

  • Minimum requirement for integrating 2FA with Drupal :
    1. Login page : Having Username and Password fields
    2. OTP Page: Having OTP fields
Drupal Headless 2FA - Flow diagram

2.1 Authenticate users by sending Username and Password

  • The first step is to authenticate users by sending Username and Password to our /headless/authenticate endpoint (API) so they can authenticate against the Drupal database. Once the user is authenticated successfully, OTP will be sent to registered mobile/email (depending on the configuration).
  • API: POST {drupal-base-URL}/headless/authenticate.
    What you will send:
    {"username":"xxxxx","password":"xxxxx","apiKey":"xxxxx"}
    If successful, you will receive back the following response:
    {"username":"xxxxx","status":"SUCCESS","message":"xxxxx","transactionID":"xxxxx","authType":"xxxxx"}

  • With the following parameters:
  • PARAMETER TYPE REQUIRED? DESCRIPTION
    username string required Entered by the user on the login form.
    password string required Entered by the user on the login form.
    apiKey string required Send the apiKey provided in the module.

2.2 Validate the user by sending OTP

  • The second step is to validate the user by sending OTP (One time passcode) to our /headless/login endpoint (API).
  • API: POST {drupal-base-URL}/headless/login
    What you will send:
    {"username":"xxxxx","transactionID":"xxxxx","authType":"xxxxx","otp":"xxxxx","apiKey":"xxxxx"}
    If successful, you will receive back the following response:
    {"username":"xxxxx","status":"SUCCESS","message":"xxxxx","userprofile":"xxxxx"}

  • With the following parameters:
  • PARAMETER TYPE REQUIRED? DESCRIPTION
    username string required You will get this in response to the first API call.
    transactionID string required You will get this in response to the first API call.
    authType string required You will get this in response to the first API call.
    otp string required You will get this in response to the first API call.
    apiKey string required Send the apiKey provided in the module.

2.3 POSSIBLE ERRORS

    ERROR CODE DESCRIPTION
    400 Authentication Failed API Authentication Failed
    404 Not Found Headless 2FA setting is not enabled. Please enable the same under the Headless 2FA Setup tab of the module.
    401 Unauthorized User has entered invalid credentials (username/password)
    403 Forbidden User has entered the incorrect OTP (One time passcode)
    500 Internal Server Error You will get 500 Internal Server Error due to various reasons, please check Drupal logs for more details.

Active Support & Other Solutions

24*7
Support

If you have any doubts or queries, you can contact us at drupalsupport@xecurify.com. We will help you to configure the module. If you want, we can also schedule an online meeting to help you configure our Drupal module.

  24*7 Support
Request
a Demo

We provide a 7 day full feature trial wherein you can fully test out all the features of the module. Please drop us an email at drupalsupport@xecurify.com and ask for a trial.

  Request for Trail
Case
Studies

Check out some of our most prominent and most popular success stories. These include Headless Solutions, Adaptive 2FA, SAML + User Provisioning and much more.

  Unique Solution
Other
Solutions

Check out our other modules for Secure Single Sign-On: Two Factor Authentication, Passwordless Authentication, Decouple / Headless Single Sign On, Provisioning, LDAP, Rest API and much more.

  KnowMore
Hello there!

Need Help? We are right here!

support
Contact miniOrange Support
success

Thanks for your inquiry.

If you dont hear from us within 24 hours, please feel free to send a follow up email to info@xecurify.com