User Entity Fields Mapping - OAuth & OIDC Login

Last updated on
4 December 2025

What is User Profile - Attribute mapping?

The attribute mapping feature allows you to map the user attributes received from the OAuth or OpenID Connect Provider to the Drupal user fields. The value received in the mapped attribute will be assigned to the corresponding Drupal field when a successful Single Sign On is performed.

Prerequisite:

How to Configure Attribute Mapping

Follow this video or the steps below to configure the Attribute Mapping feature.

  • Once you have configured the OAuth or OIDC Provider successfully, you can click on the Test Configuration button to verify if the configurations are correct or not.
  • If all the configurations are correct, you will receive a list of attributes from OAuth or OIDC Provider.
  • After you have received the attribute list, navigate to the Attribute Mapping tab under the Client Configuration tab.

    Drupal-OAuth-Client-Attribute-Mapping-Navigate-to-Attribute-Mapping-Map

Basic Attribute Mapping

The Basic/mandatory user attributes for creating a user in Drupal include Email and Username. Basic attribute mapping allows you to map Drupal Email and Username with any valid attribute received from the OAuth or OIDC Provider.

How to Configure Basic Attribute Mapping

  • Now, navigate to the Edit tab, under the Client Configuration tab.
  • In the Edit tab, under the Attribute Mapping section, the complete list of attributes received from the OAuth or OIDC Provider will be displayed on the right-hand side.

    User Profile - OAuth or OIDC Login - Basic Attribute mapping screen

  • Now, as mentioned before, basic attribute mapping includes Email and Username. Let's configure the Email and Username attributes.
  • In the Email Attribute text field, enter the Attribute Name in which the email address of the user is received from the OAuth or OIDC Provider. In our case, we have received the email address of the user under the email attribute.
  • Similarly, in the Username Attribute text field, enter the Attribute Name in which the username of the user is received from the provider. In our case, we have received the Username of the user under the cognito:username attribute.

    Drupal-OAuth-Client-Attribute-Mapping-Basic-Attribute-Mapping

  • Now, click on the Save button.

Custom Attribute Mapping

The Custom Attribute Mapping allows you to map any additional user information received from the OAuth or OIDC Provider to the user profile attributes in Drupal. This feature helps you to sync any user information other than Username and Email when the user performs SSO. In order to configure the Custom Attribute Mapping, we need to create a few user fields first.

How to add user fields in the Drupal site

  • Just for an example, we will create 2 fields - First name and Given name.
  • To create the user field in Drupal, navigate to the ConfigurationPeopleAccount settingsManage Settings.
  • Click on the + Create a new field button.

    Drupal-OAuth-Client-Attribute-Mapping-Click-Create-New-Field

  • Select Plain text under the Choose a type of field pop-up.

    Drupal-OAuth-Client-Attribute-Mapping-Choose-field-Type

  • In the Label text field, enter the first name. Drupal will automatically generate the machine name using the text that you have put in the text field.
  • Verify and then click on the Continue button.

    Drupal-OAuth-Client-Attribute-Mapping-Enter-Label

  • Verify the Maximum length and click on the Save fields settings button.
  • Now, click on the Save button.

    Drupal-OAuth-Client-Attribute-Mapping-Enter-Max.No-click-save-button

  • Similarly, you can create a field for the given name as well.

    User Profile - Attribute Mapping - fields

How to Configure Custom Attribute Mapping

  • In the Attribute tab, scroll down to the Custom Attribute Mapping section.
  • Under the OAuth Server Attribute drop-down, select the attribute in which you have received the First Name of the user. In our example, we are receiving the first name of the user under the given_name attribute. So we will select the given_name attribute from the drop-down.

    User Profile - Attribute Mapping - server attribute

  • Now, from the Drupal Machine Name drop-down, select the machine name of the first name field that we created earlier.

    User Profile - Attribute Mapping -Drupal machine name

  • Now, if you want to map multiple user attributes, you can select a number of row and click on the Add and follow the same procedure again. For example, we will map another Attribute that we are receiving - family_name.
  • Once you have mapped all the required fields as per your use case, scroll down and click on the Save button.

    User Profile - Attribute Mapping - custom attributes

Let’s see how this works

  • Open a new incognito window and go to your Drupal site's login page.
  • Click on the Login using the Provider link to initiate the SSO.
  • Once you are logged in to the Drupal site successfully, navigate to the My account link.
  • You will be able to see that the user's First name and Last name will be mapped to Drupal's respective fields.

Contact our 24*7 support team

Feel free to reach out to our Drupal experts if you need any sort of assistance in setting up OAuth2 Client SSO Login on your Drupal site.

 Get In Touch With Us Join Our Slack Channel

back to top Back to top