Add support for ROPC grant type

Created on 22 November 2023, about 1 year ago
Updated 12 December 2023, 12 months ago

Problem/Motivation

In the current module version Resource Owner Password Credentials grant type is not supported. However, there are cases where this type of grant would be useful.

See more about this type of grant: https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth-ropc

Steps to reproduce

  1. Log in as admin on your Drupal site with MS Graph API installed.
  2. Scroll to the bottom of the admin page, where "Value" section is located: /admin/config/system/keys/manage/ms_graph_api_default_key
  3. See that there are no fields available for choosing "Grant Type".
  4. 'grant_type' => 'client_credentials' is hardcoded in

Proposed resolution

Add three new fields in the settings form:

  1. Grant Type - select dropdown with two values: Client Credentials and Password
  2. Username - input field
  3. Password - input (password) field

Control visibility of Username and Password fields with form #states - visible only if Grant Type is Password.

Remaining tasks

  • Update settings form with new fields.
  • Store values of the new fields in the same way as existing field values.
  • Update GraphApiGraphFactory class to read grant_type from config.
  • Update related code/schema/config.
Feature request
Status

Needs review

Version

1.1

Component

Code

Created by

🇵🇱Poland piotrkonefal

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024