class RefreshTokenGrantService in OAuth2 Client 8.2
Same name and namespace in other branches
- 8.3 src/Service/Grant/RefreshTokenGrantService.php \Drupal\oauth2_client\Service\Grant\RefreshTokenGrantService
Handles Authorization Grants for the OAuth2 Client module.
Hierarchy
- class \Drupal\oauth2_client\Service\Oauth2ClientServiceBase implements Oauth2ClientServiceInterface
- class \Drupal\oauth2_client\Service\Grant\Oauth2ClientGrantServiceBase implements Oauth2ClientGrantServiceInterface
- class \Drupal\oauth2_client\Service\Grant\RefreshTokenGrantService
- class \Drupal\oauth2_client\Service\Grant\Oauth2ClientGrantServiceBase implements Oauth2ClientGrantServiceInterface
Expanded class hierarchy of RefreshTokenGrantService
1 string reference to 'RefreshTokenGrantService'
File
- src/
Service/ Grant/ RefreshTokenGrantService.php, line 8
Namespace
Drupal\oauth2_client\Service\GrantView source
class RefreshTokenGrantService extends Oauth2ClientGrantServiceBase {
/**
* {@inheritdoc}
*/
public function getAccessToken($clientId) {
$accessToken = $this->state
->get('oauth2_client_access_token-' . $clientId);
if ($accessToken && $accessToken
->getExpires() && $accessToken
->hasExpired()) {
$provider = $this
->getProvider($clientId);
$newAccessToken = $provider
->getAccessToken('refresh_token', [
'refresh_token' => $accessToken
->getRefreshToken(),
]);
$this
->storeAccessToken($clientId, $newAccessToken);
}
}
/**
* {@inheritdoc}
*/
public function getGrantProvider($clientId) {
return $this
->getProvider($clientId);
}
}