You are here

protected function OAuth2Client::getTokenRefreshToken in OAuth2 Client 8

Get a new access_token using the refresh_token.

This is used for the server-side and user-password flows (not for client-credentials, there is no refresh_token in it).

Throws

\Exception

1 call to OAuth2Client::getTokenRefreshToken()
OAuth2Client::getAccessToken in src/Service/OAuth2Client.php

File

src/Service/OAuth2Client.php, line 328

Class

OAuth2Client
OAuth2Client service.

Namespace

Drupal\oauth2_client\Service

Code

protected function getTokenRefreshToken() {
  if (!$this->token['refresh_token']) {
    throw new \Exception(t('There is no refresh_token.'));
  }
  return $this
    ->getToken([
    'grant_type' => 'refresh_token',
    'refresh_token' => $this->token['refresh_token'],
  ]);
}