protected function Oauth2ClientGrantServiceBase::getProvider in OAuth2 Client 8.2
Same name and namespace in other branches
- 8.3 src/Service/Grant/Oauth2ClientGrantServiceBase.php \Drupal\oauth2_client\Service\Grant\Oauth2ClientGrantServiceBase::getProvider()
Creates a new provider object.
Parameters
string $clientId: 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.
8 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.
- 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.
- RefreshTokenGrantService::getAccessToken in src/
Service/ Grant/ RefreshTokenGrantService.php - Get an OAuth2 access token.
File
- src/
Service/ Grant/ Oauth2ClientGrantServiceBase.php, line 90
Class
- Oauth2ClientGrantServiceBase
- Base class for OAuth2 Client grant services.
Namespace
Drupal\oauth2_client\Service\GrantCode
protected function getProvider($clientId) {
if (isset($this->clientProviderCache[$clientId])) {
$provider = $this->clientProviderCache[$clientId];
}
else {
$client = $this
->getClient($clientId);
$provider = new GenericProvider([
'clientId' => $client
->getClientId(),
'clientSecret' => $client
->getClientSecret(),
'redirectUri' => $this
->getRedirectUri($client),
'urlAuthorize' => $client
->getAuthorizationUri(),
'urlAccessToken' => $client
->getTokenUri(),
'urlResourceOwnerDetails' => $client
->getResourceUri(),
'scopes' => $client
->getScopes(),
'scopeSeparator' => $client
->getScopeSeparator(),
]);
$this->clientProviderCache[$clientId] = $provider;
}
return $provider;
}