Search Results :

×

Configure Custom Scopes in OAuth 2.1 Server

Custom scopes in the Drupal OAuth Server 2.1 module allow you to control which user information and resources an OAuth client can access. By creating custom scopes, you can implement granular access control and share only the required data with connected applications. This guide walks you through the steps to create and configure custom scopes in the Drupal OAuth Server.

  • Download the module:

    composer require 'drupal/oauth_server_sso'

  • Go to Extend menu on your Drupal admin console and enable the module by enabling the checkbox and click on Install button.
  • Configure the module at:

    {BaseURL}/admin/config/people/oauth_server_sso/config_client

  • Install the module:

    drush en oauth_server_sso

  • Clear the cache:

    drush cr

  • Configure the module at:

    {BaseURL}/admin/config/people/oauth_server_sso/config_client

  • Navigate to Extend menu on your Drupal admin console and click on Install new module.
  • Install the Drupal OAuth / OIDC Provider - Single Sign On (SSO) 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.
  • Configure the module at:

    {BaseURL}/admin/config/people/oauth_server_sso/config_client

  • Before configuring custom scopes, ensure that the Drupal OAuth Server module is installed and configured on your Drupal site. Refer to this setup guide to complete the configuration.
  • After creating the client or registering the application, navigate to the App Registration tab.
  • From the left-side menu, click Scopes.
Drupal OAuth Server - Click on Scopes from left navigation menu

  • In the Scopes section, you can see the default scopes for this client. You can select scopes from the default scopes.
Drupal OAuth Server - Default Scopes for the Client

  • If you want to add a new scope or edit scopes, then click the Open Scope Management button.
Drupal OAuth Server - Click Open Scope Management

  • If you want to edit or make changes to the existing scope, then click the corresponding Edit button.
Drupal OAuth Server - Click Edit Scope

  • In the Edit Scope section, make the required changes in the description and claims. You can not change the scope name.
  • After that, click the Update Scope button.
Drupal OAuth Server - Edit Scope Details and Click Update Scope

  • To add a new scope, click the Add Custom Scope button.
Drupal OAuth Server - Click Add Custom Scope

  • In the Add custom scope section, enter the required details:
    • Scope Name: Enter the name of the scope that you want to add in lowercase. Reserved built-in names cannot be reused.
    • Description: Enter the description of the scope, which is shown on the consent screen.
    • Claims: Enter the claims that should be included in the ID Token and UserInfo response when this scope is granted. Multiple claims can be added as a comma-separated list. For example, you can add uid, name, mail, role, and status for a user.read scope. Leave this field empty for scopes such as offline_access that only affect token response behaviour and do not return any claims.
  • Enable the Include by Default when no scope parameter is sent checkbox if you want this scope to be automatically included when the authorization request does not contain a scope parameter. Leave it unchecked if the scope should only be granted when explicitly requested by the client application.
  • The Enabled checkbox is selected by default. Keep it enabled to make the scope available for client applications to request. Disable this option if you do not want the scope to be available.
  • Then click the Save button.
Drupal OAuth Server - Enter Scope Details and Click Save Scope

  • After creating the scope, navigate to the Scopes section.
  • In the Scopes section, select the scopes that this client application is permitted to request by checking the corresponding checkboxes. If no scopes are selected, the client will be allowed to request any scope enabled on the OAuth server.
  • After that, click the Save Client button.
Drupal OAuth Server - Click Allow Scope and Save Client

  • After that, copy the scopes to configure your OAuth client.
Drupal OAuth Server - Click Allow Scope and Save Client

That's it. You have successfully configured the Scopes.

If you face any issues during the configuration or if you want some additional features, please contact us at drupalsupport@xecurify.com.


 Thank you for your response. We will get back to you soon.

Something went wrong. Please submit your query again

We'll Reach Out to You at the Earliest!



ADFS_sso ×
Hello there!

Need Help? We are right here!

support