This module adds back the "password grant" type for the Simple OAuth module. It allows applications to request an access token by sending user credentials directly, which can be useful for decoupled Drupal setups where the frontend is trusted.
This module re-implements the PasswordGrant for the Simple OAuth module.
This module only works with The Simple OAuth module version 6.0.x or greater!
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!
Security Concerns
The PasswordGrant was part of the Simple OAuth module in Version 5 but got removed in Version 6 because the OAuth2 best current practices removed the PasswordGrant.
However, when using Drupal in a decoupled scenario as a pure backend, you can trust your frontend application.
For best user experience, the user must be able to input their login credentials on the Drupal frontend (which is decoupled), so the PasswordGrant makes sense here.
Ask your assistant about Simple OAuth Password Grant
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
Activity
Release Timeline
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 2.1.0 | Stable | 10–11 | Mar 7, 2025 | ||
| 2.0.0 | Stable | 10–11 | Jan 8, 2025 | ||
| 2.x-dev | Dev | 10–11 | Jan 8, 2025 | ||
| 1.0.0 | Stable | 9–10 | PHP >=8.0 | Sep 19, 2024 | |
| 1.0.0-rc2 | Pre-release | 9–10 | PHP >=8.0 | Feb 8, 2023 | |
| 1.0.0-rc1 | Pre-release | 9–10 | PHP >=8.1 | Feb 8, 2023 | |
| 1.x-dev | Dev | 9–10 | PHP >=8.0 | Feb 8, 2023 |