You are here

public function Oauth2ClientServiceBase::retrieveAccessToken in OAuth2 Client 8.3

Same name and namespace in other branches
  1. 8.2 src/Service/Oauth2ClientServiceBase.php \Drupal\oauth2_client\Service\Oauth2ClientServiceBase::retrieveAccessToken()

Retrieve an access token from storage.

Parameters

string $pluginId: The client for which a provider should be created.

Return value

\League\OAuth2\Client\Token\AccessTokenInterface|null The Access Token for the given client ID.

Overrides Oauth2ClientServiceInterface::retrieveAccessToken

2 calls to Oauth2ClientServiceBase::retrieveAccessToken()
Oauth2ClientService::getAccessToken in src/Service/Oauth2ClientService.php
Obtains an existing or a new access token.
RefreshTokenGrantService::getAccessToken in src/Service/Grant/RefreshTokenGrantService.php
Get an OAuth2 access token.

File

src/Service/Oauth2ClientServiceBase.php, line 40

Class

Oauth2ClientServiceBase
Base class for OAuth2 Client services.

Namespace

Drupal\oauth2_client\Service

Code

public function retrieveAccessToken($pluginId) {
  $client = $this
    ->getClient($pluginId);
  $token = $client
    ->retrieveAccessToken();
  if ($token instanceof AccessTokenInterface) {
    return $token;
  }
  return NULL;
}