Skip to content

wunderwerkio/drupal-simple-oauth-password-grant

Repository files navigation

Simple OAuth Password Grant Lint & Test

This module re-implements the PasswordGrant for the simple_oauth module. For more information about this repository, visit the project page at https://www.drupal.org/project/simple_oauth_password_grant

Usage

To use this module, simply enable the Password grant type in your OAuth2 Consumer. 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"
}

Important The username can either be the Drupal username, or the Drupal user's email address!

Testing

A Test environment can be easily spun-up via DDEV. The drupal installation is provided by the excellent DrupalSpoons Composer Plugin.

Start local dev environment

Run the following commands in the project root:

ddev start

To change the drupal version, use

ddev change-env

PHPCS

ddev phpcs

PHPUnit

ddev phpunit