Search Results :

×

Azure AD B2C SSO OAuth / OpenID Connect Single Sign On into Magento | Azure AD B2C Login


Configure the Magento OAuth & OpenID Connect Single Sign-On (SSO) extension with Azure B2C Single Sign-On (SSO). Use Microsoft Azure B2C as an OAuth and OpenID Connect provider to provide safe login into Magento. With Azure B2C Single Sign-On (SSO), your users may log in and access your Magento site by authenticating with their Azure B2C identity provider. You can also use various IDPs, such as Azure AD, Office 365, and other bespoke providers, to configure the extension. It has powerful Single Sign-On (SSO) features like user profile attribute mapping and role mapping, among others. We'll go over how to set up Single Sign-On (SSO) for user authentication between Magento and Azure B2C in this guide.
To know more about other features we provide in Magento OAuth Single Sign-On ( OAuth & OpenID Connect Client ) extension, you can click here.

Pre-requisites : Download And Installation

Installation using Composer:
  • Purchase the miniOrange OAuth / OpenID Connect Single Sign On extension from magento marketplace.
  • Go to My profile -> My Purchases
  • Please ensure you are using correct access keys (My Profile - Access Keys)
  • Paste the access keys in your auth.json file inside your project
  • Use the below command to add the extension to your project.
    "composer require miniorange_inc/miniorange-oauth-sso"
  • You can see the module name and list of versions in the selector below the extension module name.
  • Run the following commands on command prompt to enable the extension.
  • php bin/magento setup:di:compile
    php bin/magento setup:upgrade

Manual Installation:
  • Download the miniOrange OAuth OpenID Connect Single Sign-On extension zip from here.
  • Unzip all contents of the zip inside the MiniOrange/OAuth directory.
  • {Root Directory of Magento} app code MiniOrange OAuth
  • Run the following commands on command prompt to enable the extension.
  • php bin/magento setup:di:compile
    php bin/magento setup:upgrade

Magento OAuth OpenID Connect SSO extension allows login (Single Sign-On) into Magento with your Azure AD, Azure B2C, AWS Cognito, WSO2, Okta, LinkedIn, Google, Facebook, Slack, Discord or other custom OAuth 2.0 providers [24/7 SUPPORT]

 Tested with 2.4.5

Steps to configure Azure AD B2C OAuth & OpenID Single Sign-On (SSO) Login into Magento

1. Setup Azure Active Directory B2C as OAuth Provider

Follow the steps below to configure Azure AD B2C as OAuth Provider

miniorange img Configure Azure AD B2C as OAuth Provider
    <
  • Sign in to Azure portal.
  • Go to Home and in the Azure services, select Azure AD B2C.
  • Azure AD B2C Single Sign-on (SSO) - Select Azure AD B2C
  • Please make sure you are in the Azure AD B2C directory with an active subscription and if not, you can switch to the correct directory.
  • Azure AD B2C Single Sign-on (SSO) - Login Applications
  • In the Essentials tab, you will find the Azure B2C domain name, keep it handy, you will need it later for configuring the Azure B2C tenant name under Magento OAuth SSO extension.

    What is Tenant Name?
    You will need to copy the highlighted domain name portion only as shown in the below screenshot in order to configure the tenant name in the Magento OAuth SSO extension.
    Eg. If your domain name is 'exampledomain.onmicrosoft.com', then your tenant name will be 'exampledomain'.


  • Azure AD B2C Single Sign-on (SSO) - Generate Key
  • Now, click on App registrations and then click on the New registration option to create a new Azure b2c application.
  • Azure AD B2C Single Sign-on (SSO) - Login Applications
  • Configure the following options to create a new application.
    • Enter a name for your application under the Name text field.
    • In supported account types, select 3rd option ‘Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)’
    • In the Redirect URI section, select the Web application and enter the Callback URL from the miniOrange OAuth Client plugin (Configure OAuth tab) and save it under the Redirect URL textbox.
    • Click on the Register button to create your application.
    • Azure AD B2C Single Sign-on (SSO) - Create
  • After successful application creation, you will be redirected to the newly created application’s overview page. If not, you can go to the app registrations and search the name of your application and you will find your application in the list.
  • Azure AD B2C Single Sign-on (SSO) - Applications option
  • Copy your Application ID and keep it handy, you will need it later for configuring the Client ID under Magento OAuth SSO extension.
  • Azure AD B2C Single Sign-on (SSO) - Application ID
  • Now, click on Certificates and secrets and then click on New client secret to generate a client secret. Enter a description and click on the Add button.
  • Azure AD B2C Single Sign-on (SSO) - Generate Key
  • Copy the secret value from certificates & secrets page and keep it handy, you will need it later for configuring the Client Secret under Magento OAuth Client extension.
  • Azure AD B2C Single Sign-on (SSO) - Generate Key

Step 1.1: Add Users in your B2C application

  • In home page, go to the Users tab in the left corner
  • Azure AD B2C Single Sign-on (SSO) - user flow
  • Click on New user in the users page
  • Azure AD B2C Single Sign-on (SSO) - user flow
  • Select Create Azure AD B2C user. Then, scroll down and click on Email from sign in method and set your password and click create to save the user details to perform test configuration.
  • Azure AD B2C Single Sign-on (SSO) - user flow Azure AD B2C Single Sign-on (SSO) - user flow

Step 1.2: How to create & add Azure B2C Policy

  • Go to User Flows tab and then click on New user flow.
  • Azure AD B2C Single Sign-on (SSO) - user flow
  • Select a User flow type Sign up and Sign in then click on Create button.
  • Azure AD B2C Single Sign-on (SSO) - sect user flow
  • Fill all the information e.g. Name, Identity providers, etc. then click on Create button.
  • Azure AD B2C Single Sign-on (SSO) - information of user flow
  • Copy the Policy name this value whenever you need to enter Azure B2C Policy in miniOrange OAuth Client extension.

Step 1.3: Add user claims to your application

  • Go to user flows under policies in the left corner. Select the configured policy.
  • Azure AD B2C Single Sign-on (SSO) - information of user flow
  • Select Application claims in settings
  • Azure AD B2C Single Sign-on (SSO) - information of user flow
  • Select the desired attributes to be displayed on the test configuration and save it.
  • Azure AD B2C Single Sign-on (SSO) - information of user flow

Step 1.4: Configure ID-Token Claims in Azure B2C [Premium]

  • Go to your application in Azure Active Directory and select Token configuration from the left menu.
  • Click on Add optional claim and then select ID from the right section.
  • Now choose all the attributes you want to fetch while SSO (e.g family_name, given_name, etc) and click on Add button.
  • You might see a popup to Turn on the Microsoft Graph profile permission (required for claims to appear in token), enable it, and click on Add button.
  • Azure B2C B2C Single Sign-on (SSO) - Custom Attribute Mapping

You've successfully configured Azure AD (Active Directory) B2C as an OAuth Provider for Magento user integration using Azure AD Single Sign-On (SSO)



2. Configuring Magento 2 as OAuth Client

  • After successfully configuring OAuth Provider, go to OAuth Provider tab and configure OAuth Provider Name, Client ID, Client Secret, Scope and provided endpoints.

    Please refer below Endpoints to configure the OAuth Client


    Scope: openid
    Authorize Endpoint: https://<domain-name >.b2clogin.com/<domain-name>.onmicrosoft.com/<policy-name>/oauth2/v2.0/authorize
    Access Token Endpoint: https://<domain-name>.b2clogin.com/<domain-name>.onmicrosoft.com/<policy-name>/oauth2/v2.0/token
    Get User Info Endpoint: https://graph.microsoft.com/v1.0/me
    Custom redirect URL after logout: [optional] https://<domain-name>.b2clogin.com/<domain-name>.onmicrosoft.com/<policy-name>/oauth2/v2.0/logout?post_logout_redirect_uri=<your url>
  • Click on the Save button to save the settings.
  • Click on the Test Configuration button.
  • Magento 2 OAuth credentials Azure AD B2C SSO OAuth
  • You will see all the values returned by your OAuth Provider to Magento in a table. If you don't see value for First Name, Last Name, Email or Username, make the required settings in your OAuth Provider to return this information.

3. Sign-In Settings

  • Navigate to Sign-in Settings tab. Here you find the option the enable the login link on Admin*/Customer Login Page (*Admin SSO is available in the premium versions)
  • Magento 2 SSO Azure AD Single Sign-on (SSO) Admin Customer SSO
  • If you want to initate SSO from any page you can also use the SSO link provided in the extension.
  • Magento SSO using SSO link Magento 2 SSO Azure AD
  • The Premium extension also provides you the the feature to auto redirect your user to the IdP Login Page if the user is not already logged in.
  • Magento 2 OAuth auto redirect to idp

4. Customer / Admin SSO



  • Go to customer login page and you will see the SSO button on your frontend. Click on the button and test the SSO.
  • Magento 2 OAuth SSO customer SSO
  • You will be sucessfully logged in into Magento.
  • magento SSO magento 2 OAuth client SSO Admin SSO

Attribute / Custom Attribute Mapping (Optional). *This is Premium feature.

1.1: Attribute Mapping (Optional). *This is Premium feature.

  • You can map attributes in the Attribute Mapping tab. Only username and email are allowed to be mapped in free version of the extension. However, in the premium version of the extension, you can map various attributes coming from your OAuth Provider to the attributes present in your Magento site.
  • Magento 2 OAuth attribute mapping

1.2: Custom Attribute Mapping (Optional). *This is Premium feature.

  • Enter your table name in Table field.
  • Enter attribute name as your column name (in the respective table)
  • Click on Add button for adding custom magento attribute and map the respective field with the attribute receiving from your identity provider
  • Click on save button for saving the configuration.
  • You can also delete the configuration by entering the name in attribute name field and then click on delete button.
  • Magento 2 OAuth custom attribute mapping

Role Mapping (Optional). *This is Premium feature.

  • You can specify a default role in the free extension that will be allocated to all non-admin users when they conduct SSO.
  • Go to Attribute/Role mapping tab and navigate to Role Mapping section.
  • Select the Default Role and click on the Save button.
  • Azure AD Magento SSO - Azure B2C Single Sign-On(SSO) Login in Magento - role mapping

By configuring Azure AD B2C as an OAuth Provider and Magento as an OAuth Client using our Magento OAuth Client extension, you have successfully installed Magento Azure AD (Active Directory) B2C Single Sign-On (SSO). Within minutes, you'll be able to provide safe access to your Magento site utilising Azure AD B2C login credentials thanks to this solution.p>

Additional Resources


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