You are here

protected function Client::getTokenRefreshToken in OAuth2 Client 7.2

Same name and namespace in other branches
  1. 7 oauth2_client.inc \OAuth2\Client::getTokenRefreshToken()

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).

1 call to Client::getTokenRefreshToken()
Client::getAccessToken in src/Client.php
Get and return an access token.

File

src/Client.php, line 264
Class OAuth2\Client.

Class

Client
The class OAuth2\Client is used to communicate with an oauth2 server.

Namespace

OAuth2

Code

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