Problem/Motivation

We currently only support the client_credentials grant for OAuth. The simple OAuth module deprecated the password grant, but a re-implementation with sizable usage exists: https://www.drupal.org/project/simple_oauth_password_grant

Adding support for this could address some common use cases, including some requests from the community.

Proposed resolution

Introduce a grant_type option for OAuth authentication. We should make this optional and default to 'client_credentials' for backwards compatibility.

From the password grant module page:

You can then obtain an access token by requesting it with the following payload:

{
"grant_type": "password",
"client_id": "__your-client-id__",
"client_secret": "__your-client-secret__",
"username": "drupal_username_or_email",
"password": "drupal_password"
}

Once we get a token, we should handle it the same way we do for tokens from the client_credentials grant.

Remaining tasks

* Implement changes.
* Update tests
* Update docs

API changes

Introduces an optional 'grant type' for OAuth authentication.

Issue fork api_client-3468108

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

brianperry created an issue. See original summary.

brianperry’s picture

Parent issue: » #3440572: [Meta] 1.x Roadmap

brianperry’s picture

Assigned: Unassigned » brianperry
brianperry’s picture

brianperry’s picture

Issue tags: +Barcelona2024
brianperry’s picture

Assigned: brianperry » Unassigned
Status: Active » Needs review

brianperry’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.