Search Results :

×

Azure AD B2C SSO Login with Drupal OAuth Client | Drupal SSO Login


Drupal Azure AD B2C SSO integration will allow you to configure Single Sign-On ( SSO ) login between your Drupal site and Azure AD B2C using OAuth/OpenID protocol. Drupal OAuth 2.0/OpenID connect module gives the ability to enable login using OAuth 2.0/OIDC Single Sign-On to Drupal Site. We provide the Drupal OAuth/OpenID Client module for Drupal 7, Drupal 8, Drupal 9, and Drupal 10.
Here we will go through a guide to configure the SSO login between Drupal and Azure AD B2C. By following these steps, users of Azure AD B2C will be able to log into the Drupal site using their Azure AD B2C credentials.
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 Drupal OAuth & OpenID Connect Login – OAuth2 Client SSO Login module.


Pre-requisite: Download and Installation 


  • Download the module:
    Composer require 'drupal/miniorange_oauth_client'
  • Navigate to Extend menu on your Drupal admin console and search for miniOrange OAuth Client Configuration using the search box.
  • Enable the module by checking the checkbox and click on the Install button.
  • You can configure the module at:
    {BaseURL}/admin/config/people/miniorange_oauth_client/config_clc
  • Install the module:
    drush en drupal/miniorange_oauth_client
  • Clear the cache:
     drush cr
  • You can configure the module at:
    {BaseURL}/admin/config/people/miniorange_oauth_client/config_clc
  • Navigate to Extend menu on your Drupal admin console and click on Install new module.
  • Install the Drupal OAuth & OpenID Connect Login - OAuth2 Client SSO 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.
  • You can configure the module at:
    {BaseURL}/admin/config/people/miniorange_oauth_client/config_clc

Video Setup Azure AD B2C Single Sign-on Integration with Drupal OAuth/OpenID Client

You can refer the steps to configure Azure AD B2C SSO integration with the Drupal OAuth/OIDC Client module from the Video or Documentation given below:




How to Integrate Azure AD B2C Single Sign-on with Drupal OAuth/OpenID Client

1. Setup Drupal as an OAuth Client

  • After installing the module, navigate to the Configuration tab and click on the Drupal OAuth Client Configuration module link.
  • Drupal OAuth Client - Configuration tab and select Drupal OAuth Client Configuration module
  • In the Configure OAuth tab, select the Azure AD B2C provider from the Select Application dropdown list.
  • Drupal OAuth Client - Select Azure AD B2C provider from the Select Application
  • Copy the Callback/Redirect URL and keep it handy.
  • Please Note: If your provider only supports HTTPS Callback/Redirect URL and you have an HTTP site, just save your base site URL in the Sign In Settings tab with HTTPS.

  • Enter the application name in the Custom App Name text field. For example, Azure B2C
  • Drupal OAuth Client - Copy the Callback URL and enter the Display Name

2. Create SSO Application in Azure AD B2C

  • Log in to the Microsoft Azure portal.
  • In the Azure services section, select Azure AD B2C.
  • Microsoft Azure Home - Select Azure AD B2C
  • To build a new Azure B2C application, navigate to the App registrations in the left-hand navigation panel, then click on the New registration button.
  • Microsoft Azure Create New Application
  • In the Register an application window, enter the necessary information for creating a new application:
    • Name: Enter the application's name in the Name text field.
    • Supported account types: Select the 3rd option, Accounts in any organizational directory (for authenticating users with user flows). You can also refer to Help me choose option if it is worthwhile.
    • Select Web from the Select a platform drop-down option for Redirect URI (recommended). Then, in the text field, paste the previously copied Callback/Redirect URL.
    • Click on the Register button.
    • Microsoft Azure AD B2C portal, Enter required information in Register an application window

3. Integrating Drupal with Azure AD B2C

  • Azure AD B2C assigns a unique Application ID to your application. Copy the Application (client) ID. This will be your Client ID.
  • Microsoft Azure B2C - Copy the Application ID
  • In Drupal’s Configure OAuth tab paste the copied Application (client) ID into the Client ID text field.
  • Drupal OAuth-OpenID Connect Single Sign On (SSO), Paste the copied Application ID into Client ID
  • Navigate to the Azure Portal, then select Certificates and secrets from the left side panel, and then click on New client secret button to generate a client secret.
  • Microsoft Azure B2C to generate the Client Secret
  • In the Add client a secret popup, enter the following information:
    • Description: Enter a description for this client secret.
    • Expires: Select the duration from the Expires dropdown option.
    • Then, click on the Add button.
    • Microsoft Azure - In the Add a client secret popup, enter the description and expires
  • After that, copy the Value from the Client secrets tab. This will be your Client Secret key.
  • Copy the Client Secret Value from the Azure Active Directory portal
  • In Drupal’s Configure OAuth tab paste the copied Client Secret Value into the Client Secret textfield.
  • Drupal OAuth/OpenID/OIDC Single Sign On (SSO), Paste the copied value into the client secret text area
  • Go to the Microsoft Azure portal.
  • Click on Azure AD B2C | App registrations link from the top left.
  •  Select Azure AD B2C - App registrations from the Azure portal
  • Navigate to the Overview tab from the left side panel.
  •  Select Azure AD B2C - click on Overview
  • Under the Essentials section, copy the Domain name. (This is your Tenant's Name)
  • From Microsoft Azure - Copy the Domain name
  • Replace the previously copied Domain name with the {tenant-name} in the Authorize Endpoint and Access Token Endpoint text fields in Drupal's Configure OAuth tab.
  • Drupal OAuth Client - Replace the copied Domain name with the tenant name Endpoints url

4. Create User Flow Policy in Azure AD B2C

  • Go to the Microsoft Azure portal.
  • Select User flows from the Policies section.
  • Microsoft AAD portal - select user flows option
  • Click on the New user flow button.
  • Create New user flow button
  • Select the Sign up and sign in card/box for user flow in the Create a user flow panel.
  • AzureB2C user flow select type
  • Select the Recommended card/box under Version. Then, click on the Create button.
  • select version and click on create
  • Enter the following information in the Create window:
    • Enter the Name of the user flow. For instance, B2C_1_ AzureB2CTest. (This cannot be altered once a user flow has been created.)
    • Select Email signup under Identity Providers.
    • Select the Multifactor authentication option as per your requirement. if you are not sure, keep the default option.
    • User attributes and token claims: Choose which claims and attributes you want to collect from the user throughout the sign-up process. Click on the Show more button. On the Create popup window, it's mandatory to enable the checkboxes Email Address (Below Collect attribute) and Email Addresses (Below Return claim), and you can also add other attributes as per requirement. Click on Ok button.
    • Then, click on Create button to add user flow. (The B2C_1_ prefix is automatically appended to the name.)
    • In the Create window, enter required information
  • Copy the Name for user flow. (This is your Policy name)
  • AAD B2C portal - Copy the user flow policy name
  • Navigate to the Drupal Configure OAuth tab and replace the previously copied Name with the {policy-name} in the Authorize Endpoint and Access Token Endpoint text fields.
  • The Send Client ID and Secret in header or body checkbox is used to send the Client ID and Secret in the Token End Point Request in header or body.
  • Please Note: if you're unsure which option to choose for enabling the header or body, you can keep the default options.

  • Click on the checkbox to Enable Login with OAuth.
  • Now, click on the Save Configuration button.
  • Drupal OAuth/OpenID/OIDC Single Sign On (SSO), AzureB2C paste policy name

    You may also glance at Azure AD B2C Application Endpoints and Scope:


    Scope: openid
    Authorize Endpoint: https://{tenant-name}.b2clogin.com/{tenant-name}.onmicrosoft.com/{policy-name}/oauth2/v2.0/authorize
    Access Token Endpoint: https://{tenant-name}.b2clogin.com/{tenant-name}.onmicrosoft.com/{policy-name}/oauth2/v2.0/token

5. Test Configuration of Drupal with Azure AD B2C

  • After successfully saving the configurations, click on Perform Test Configuration button to test the connection between Drupal and Azure AD B2C.
  • Test the connection between Drupal and AAD B2C - Test Configuration
  • On a Test Configuration popup, if you don't have any active sessions on the same browser, you will be requested to login into the Azure B2C. After successfully logging into the Azure Active Directory B2C, you will be provided a list of attributes received from the Azure AD B2C.
  • Scroll down and click on the Configure Attribute / Role Mapping button.
  • You will see list of attribute coming from AAD B2C
  • Now, in the Attribute & Role Mapping tab, you can see a list of Attributes received from the OAuth Server window on the right side. Then, copy the attribute name that contains the email address and paste it into the Email Address text field.
  • Copy the attribute name which contains the name and paste it into the Name Attribute text field.
  • Then, scroll to the bottom and click on the Save Configuration button.
  • Attribute and Role Mapping in Drupal

    Please note: Mapping the Email Attribute is mandatory for your login to work.

  • Now log out and go to your Drupal site’s login page. You will automatically find a Login with Azure B2C link there. If you want to add the SSO link to other pages as well, please follow the steps given in the image below :
  • Azure AD B2C sso login with drupal OAuth OpenID Single Single On DeviantArt test Configuration successfully

24*7 Active Support

If you face any issues or if you have any questions, please feel free to reach out to us at drupalsupport@xecurify.com. In case you want some additional features to be included in the module, please get in touch with us, and we can get that custom-made for you. Also, If you want, we can also schedule an online meeting to help you configure the Drupal OAuth/OpenID Single Sign On module.

Additional Resources

Our Other modules

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