On this page
- What is User Profile - Attribute mapping?
- Prerequisite:
- How to Configure Attribute Mapping
- Basic Attribute Mapping
- How to Configure Basic Attribute Mapping
- Custom Attribute Mapping
- How to add user fields in the Drupal site
- How to Configure Custom Attribute Mapping
- Let’s see how this works
- Contact our 24*7 support team
User Entity Fields Mapping - OAuth & OIDC Login
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:
- Install and activate the OAuth & OpenID Connect Login - OAuth2 Client SSO Login module on your Drupal site. Follow these steps to install the module.
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.

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.

- 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.

- 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 Configuration → People → Account settings → Manage Settings.
-
Click on the + Create a new field button.

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

- 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.

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

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

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.

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

- 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.

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.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion