You are here

public function ResourceOwnersCredentialsGrantService::setUsernamePassword in OAuth2 Client 8.3

Pass credentials in memory to be used in the oauth request.

It may not be necessary, but storing by client id in case some edge case has two or more client plugins operating on the same request.

Parameters

string $pluginId: The id of the Oauth2Client plugin implementing this grant type.

string $username: Optional - The username if needed by the grant type.

string $password: Optional - The password if needed by the grant type.

File

src/Service/Grant/ResourceOwnersCredentialsGrantService.php, line 60

Class

ResourceOwnersCredentialsGrantService
Handles Authorization Grants for the OAuth2 Client module.

Namespace

Drupal\oauth2_client\Service\Grant

Code

public function setUsernamePassword($pluginId, $username, $password) {
  $this->usernamesPasswords[$pluginId] = [
    'username' => $username,
    'password' => $password,
  ];
}