class RefreshTokenGrantService in OAuth2 Client 8.3
Same name and namespace in other branches
- 8.2 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 10 
Namespace
Drupal\oauth2_client\Service\GrantView source
class RefreshTokenGrantService extends Oauth2ClientGrantServiceBase {
  /**
   * {@inheritdoc}
   */
  public function getAccessToken($pluginId) {
    $accessToken = $this
      ->retrieveAccessToken($pluginId);
    if ($accessToken instanceof AccessTokenInterface) {
      $expirationTimestamp = $accessToken
        ->getExpires();
      if (!empty($expirationTimestamp) && $accessToken
        ->hasExpired()) {
        $provider = $this
          ->getProvider($pluginId);
        $newAccessToken = $provider
          ->getAccessToken('refresh_token', [
          'refresh_token' => $accessToken
            ->getRefreshToken(),
        ]);
        $this
          ->storeAccessToken($pluginId, $newAccessToken);
      }
    }
  }
  /**
   * {@inheritdoc}
   */
  public function getGrantProvider($pluginId) {
    return $this
      ->getProvider($pluginId);
  }
} 
      