Search Results :

×

SSO Login into Magento using Drupal as OAuth/OIDC Provider


Drupal SSO integration will allow the users to log in to the Magento using the Drupal site Credentials. This SSO integration is achieved by the miniOrange OAuth / OpenID Connect server module which uses the OAuth 2.0 and OpenID Connect protocol. The module is compatible with all OAuth / OpenID Connect clients and is available for Drupal 7, Drupal 8, Drupal 9, and Drupal 10.

In this setup guide, we will help you configure the Single Sign-on login using the OAuth protocol between the Drupal site and the Magento.

Installation Steps:


  • Download the module:
    composer require 'drupal/oauth_server_sso'
  • Go to Extend menu on your Drupal admin console and enable the module by enabling the checkbox and click on Install button.
  • Configure the module at:
    {BaseURL}/admin/config/people/oauth_server_sso/config_client
  • Install the module:
    drush en oauth_server_sso
  • Clear the cache:
     drush cr
  • Configure the module at:
    {BaseURL}/admin/config/people/oauth_server_sso/config_client
  • Navigate to Extend menu on your Drupal admin console and click on Install new module.
  • Install the Drupal OAuth / OIDC Provider - Single Sign On (SSO) 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/oauth_server_sso/config_client

Setup Magento as OAuth Client:

Follow the steps below to install the miniOrange OAuth Client plugin in Magento:

  • Download the miniOrange OAuth Client plugin zip.
  • Go to the Magento root directory.
  • Create the new directories MiniOrange/OAuth inside the app/code directory.
  • Unzip all contents of the zip inside the MiniOrange/OAuth directory.
  • Run the following commands on the command prompt to enable the plugin:
    php bin/magento setup:upgrade
    php bin/magento setup:di:compile
  • Once the module is installed, navigate to the OAuth Client -> OAuth Settings tab of the module and copy the Callback URL.
  • Install and activated the miniOrange OAuth Client plugin in Magento E-commerce - Copy Callback URL

Configure Drupal as an OAuth Server:

Note: Please ensure that the Drupal site is hosted on a server accessible from Magento.

  • On the Drupal site, go to the Configuration -> miniOrange OAuth server configuration -> OAuth Client
  • Click on the Add Client button.
  • Enter the Application Name under the Application Name text field.
  • Paste the copied Callback URL under the Callback/Redirect URL text field.
  • Multiple Callback URLs can be added by clicking on the Add More button next to the text field.
  • Click on the Save button and copy the Client ID and Client Secret.

Integrating Magento with Drupal:

  • Navigate to the Magento dashboard.
  • Under the OAuth Provider Name, enter the OAuth Server Name (Drupal) and paste the copied Client ID and Client Secret into the respective text field.
  • Drupal Magento OAuth/OIDC Provider - Enter OAuth Provider Name, paste the copied Client ID and Client Secret values
  • Navigate to the Drupal site. Scroll down to the Scope and Endpoints section and copy the Scope.
  • Return to the Magento dashboard console and paste the copied Scope under the Scope text field.
  • Drupal Magento OAuth/OIDC Provider - Paste the copied Scope value in magento Scope text field
  • Select the Enter Endpoints option from the OAuth Endpoints radio button.
  • Drupal Magento OAuth/OIDC Provider - From OAuth Endpoints, choose the Enter Endpoints option
  • Add the Endpoints as specified in the table below (You can also get the same from the Scope & Endpoints section of the Drupal site -> Configuration -> miniOrange OAuth server configuration -> OAuth Client):

    Authorization Endpoint {base_url_of_the_drupal_site}/mo/oauth2/authorize
    Access Token Endpoint {base_url_of_the_drupal_site}/mo/oauth2/token
    Get User Info Endpoint {base_url_of_the_drupal_site}/mo/oauth2/userinfo
Drupal Magento OAuth/OIDC Provider - Give the specified endpoint from the table above
  • Click on the Save button.
  • Drupal Magento OAuth/OIDC Provider - Click on Save

    Test Connection between Magento and Drupal:

    • Click on the Test Configuration button to confirm if the configurations are correct.
    • Navigate to the Sign-in Settings tab.
    • Enable the Show the Login Link on the default customer login page checkbox and click on the Save button.
    • Testing between Magento and Drupal OIDC Provider - Navigate Sign-in Settings, enabling the checkbox Show the login link on the default customer

    You have successfully configured Magento as an OAuth Client and Drupal as an OAuth server.

    Let’s see how this works:

    • Open a new window/private browser and navigate to the login page of the Magento website.
    • Click on the Login with Drupal button.
    • Open a new browser or private window to access the login page of Magento website
    • Enter the Drupal credentials and click on the Log in button.
    • Sign in with your Drupal credentials and click on Log in
    • On successful authentication, browser will be redirected with successful login into the Magento.

    You have successfully performed the SSO between Magento and Drupal!

    Need Assistance?

    If you face any issues during the configuration or if you want some additional features, please contact us at drupalsupport@xecurify.com.

    Additional Features:

     Case Studies
    miniOrange has successfully catered to the use cases of 400+ trusted customers with its highly flexible/customizable Drupal solutions. Feel free to check out some of our unique case studies using this link.
     Other Solutions
    Feel free to explore other Drupal solutions that we offer here. The popular solutions used by our trusted customers include Two Factor Authentication - 2FA, Website Security, REST & JSON API Authentication, User Provisioning and Sync. 
      24*7 Active Support
    The Drupal developers at miniOrange offer quick and active support for your queries. We can assist you from choosing the best solution for your use case to deploying and maintaining the solution.
    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