protected function Oauth2ClientGrantServiceBase::getProvider in OAuth2 Client 8.3
Same name and namespace in other branches
- 8.2 src/Service/Grant/Oauth2ClientGrantServiceBase.php \Drupal\oauth2_client\Service\Grant\Oauth2ClientGrantServiceBase::getProvider()
Creates a new provider object.
Parameters
string $pluginId: The client for which a provider should be created.
Return value
\League\OAuth2\Client\Provider\GenericProvider The provider of the OAuth2 Server.
Throws
\Drupal\oauth2_client\Exception\InvalidOauth2ClientException Exception thrown when trying to retrieve a non-existent OAuth2 Client.
9 calls to Oauth2ClientGrantServiceBase::getProvider()
- AuthorizationCodeGrantService::getAccessToken in src/
Service/ Grant/ AuthorizationCodeGrantService.php - Get an OAuth2 access token.
- AuthorizationCodeGrantService::getGrantProvider in src/
Service/ Grant/ AuthorizationCodeGrantService.php - Get the league/oauth2 provider.
- AuthorizationCodeGrantService::requestAccessToken in src/
Service/ Grant/ AuthorizationCodeGrantService.php - Executes an authorization_code grant request with the give code.
- ClientCredentialsGrantService::getAccessToken in src/
Service/ Grant/ ClientCredentialsGrantService.php - Get an OAuth2 access token.
- ClientCredentialsGrantService::getGrantProvider in src/
Service/ Grant/ ClientCredentialsGrantService.php - Get the league/oauth2 provider.
File
- src/
Service/ Grant/ Oauth2ClientGrantServiceBase.php, line 89
Class
- Oauth2ClientGrantServiceBase
- Base class for OAuth2 Client grant services.
Namespace
Drupal\oauth2_client\Service\GrantCode
protected function getProvider($pluginId) {
if (isset($this->clientProviderCache[$pluginId])) {
$provider = $this->clientProviderCache[$pluginId];
}
else {
$client = $this
->getClient($pluginId);
$provider = new GenericProvider([
'clientId' => $client
->getClientId(),
'clientSecret' => $client
->getClientSecret(),
'redirectUri' => $client
->getRedirectUri(),
'urlAuthorize' => $client
->getAuthorizationUri(),
'urlAccessToken' => $client
->getTokenUri(),
'urlResourceOwnerDetails' => $client
->getResourceUri(),
'scopes' => $client
->getScopes(),
'scopeSeparator' => $client
->getScopeSeparator(),
]);
$this->clientProviderCache[$pluginId] = $provider;
}
return $provider;
}