Basic Authentication

Created on 25 July 2023, over 1 year ago
Updated 21 September 2023, about 1 year ago

Problem/Motivation

It should be possible to make requests to JSON:API using Drupal Core's basic authentication.

Proposed resolution

The options argument of the ApiClient class will support an additional optional 'authentication' property. Which allows authentication of type 'basic'. If a username and password is provided, requests to JSON:API will be made using basic authentication.

Remaining tasks

* Implement the necessary changes
** Add authentication option. Thinking something similar to:

{
  authentication: {
    type: 'basic',
    username: 'username',
    password: 'password'
  }
}

** If provided, fetch requests will be made with the following additional header:

Authorization: username:password (base 64 encoded)

* Define necessary types
* Document the current ApiClient class inline.
* Add test coverage.

API changes

* The options object will now include a authentication property.
* Fetch will be updated to set the necessary headers.

Feature request
Status

Fixed

Component

Code

Created by

🇺🇸United States brianperry

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

Comments & Activities

Production build 0.71.5 2024