Login with Office 365 Single Sign-On (SSO) using WordPress OAuth | WordPress Office 365 SSO
Overview
Office 365 Single Sign-On (SSO) integration on your WordPress website with WordPress OAuth & OpenID Connect Single Sign-On (SSO) plugin easily enables your users to conveniently log into your websites and applications with Single Sign-On (SSO) using a single set of credentials from their Office 365 account. With Office 365 as the OAuth Provider and WordPress as the OAuth Client, our plugin ensures a seamless SSO experience between the WordPress and Office 365 platforms with just a single click. In addition to Office 365 Single Sign-On (SSO), our WordPress SSO plugin offers advanced features for Office 365 integration. This includes User profile attribute mapping, Role mapping, and granting site access based on organization email domains. For added security, you can even protect your entire WordPress site behind the WordPress Office 365 Single Sign-On (SSO). By implementing Office 365 SSO, our plugin enhances user authentication and safeguards the login process. To get started, simply follow the step-by-step instructions in the guide below to install and configure the plugin for your Office 365 Office 365 Single Sign-On (SSO) setup.
Pre-requisites : Download And Installation
- Log into your WordPress instance as an admin.
- Go to the WordPress Dashboard -> Plugins and click on Add New.
- Search for a WordPress OAuth Single Sign-On (SSO) plugin and click on Install Now.
- Once installed click on Activate.
Steps to Login into WordPress with Office 365 Single Sign-On (SSO)
1. Setup Office 365 as OAuth Provider
- Sign in to Microsoft Entra ID (Azure AD) portal.
- Select Microsoft Entra ID (Azure AD).
- In the left-hand navigation panel, click the App registrations service, and click New registration.
- 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.
- A unique Application ID is assigned to your application by Azure AD. Keep the Application ID and the Directory ID handy, they will become your Client ID and Tenant ID, which will be needed later to configure the miniOrange OAuth Client plugin.
- Go to API permissions from the left navigaton pane and click on Add permissions. Then select Office 365.
- Select permissions and click on Add Permissions button.
- Go to Certificates and Secrets from the left navigaton pane and click on New Client Secret. Enter description and expiration time and click on ADD option.
- Copy the secret key "value" and keep the value handy it will be required later to configure Client Secret under the miniOrange OAuth Client Plugin.
Note: The client secret for your developer application will expire in 180 days. To ensure continued functionality, you will need to generate a new client secret before the expiration and update it in the OAuth Single Sign-On plugin.
You have successfully configured Office 365 as OAuth Provider to enable Office 365 Single Sign-On (SSO) with WordPress, allowing user authentication through the Office 365 login.
2: Setup WordPress as OAuth Client
- Free
- Premium
3. User Attribute Mapping
- User Attribute Mapping is mandatory for enabling users to successfully login into WordPress. We will be setting up user profile attributes for WordPress using below settings.
Finding user attributes
- Go to Configure OAuth tab. Scroll down and click on Test Configuration.
- You will see all the values returned by your OAuth Provider to WordPress 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.
- Once you see all the values in Test Configuration, go to Attribute / Role Mapping tab, you will get the list of attributes in a Username dropdown.
4. Office 365 Group Mapping
- Go to Application → Select the application where you want to configure the group mapping for Office 365 SSO. Now, Go to the API Permissions tab.
- Click on the Add permission button, and then Microsoft Graph API -> Delegated Permissions and select openid, Profile scope and click on the Add Permissions button.
- Click on the Grant consent for Demo button.
- Go to Manifest tab and find groupMembershipClaims and changes it’s value to "All" and click on the save button.
- Now you would be able to get the group's value in the Test configuration window.
- You can follow the role mapping section to map the groups to WordPress users while Azure B2C SSO.
5. Role & Group Mapping [Premium]
- Click on “Test Configuration” and you will get the list of Attribute Names and Attribute Values that are sent by your OAuth provider Office 365.
- From the Test Configuration window, map the Attribute Names in the Attribute Mapping section of the plugin. Refer to the screenshot for more details.
- Enable Role Mapping: To enable Role Mapping, you need to map Group Name Attribute. Select the attribute
name from the list of attributes which returns the roles from your provider application.
Eg: Groups - Assign WordPress role to the Provider role: Based on your provider application, you can allocate the
WordPress role to your provider roles. It can be a student, teacher, administrator or any other depending on
your application. Add the provider roles under Group Attribute Value and assign the required WordPress role in
front of it under WordPress Role.
For example, in the below image. Teacher has been assigned the role of Administrator & Student is assigned the role of Subscriber. - Once you save the mapping, the provider role will be assigned the WordPress administrator role after
SSO.
Example: As per the given example, Users with role ‘teacher’ will be added as Administrator in WordPress and ‘student’ will be added as Subscriber.
6. Sign In Settings
- WordPress 5.7 and below
- WordPress 5.8
- WordPress 5.9 and above
In conclusion, after successfully configuring Office 365 as an OAuth Provider and WordPress as an OAuth Client, you've achieved a smooth and secure authentication process for your users. Through Office 365 Single Sign-On (SSO), you can ensure a robust user experience within the WordPress environment. This allows user authentication through the Office 365 login. Through the integration of Office with WordPress users can securely log into their WordPress accounts with their existing Office 365 credentials.