You are here

public function Authentication::refresh_token in Auth0 Single Sign On 8.2

Use a refresh token grant to get new tokens.

@link https://auth0.com/docs/api/authentication#refresh-token

Parameters

string $refresh_token Refresh token to use.:

array $options Array of options to override defaults.:

Return value

mixed

Throws

ApiException If $refresh_token, client_secret, or client_id is blank.

File

vendor/auth0/auth0-php/src/API/Authentication.php, line 524

Class

Authentication
Class Authentication

Namespace

Auth0\SDK\API

Code

public function refresh_token($refresh_token, array $options = []) {
  if (empty($refresh_token)) {
    throw new ApiException('Refresh token cannot be blank');
  }
  if (!isset($options['client_secret'])) {
    $options['client_secret'] = $this->client_secret;
  }
  if (empty($options['client_secret'])) {
    throw new ApiException('client_secret is mandatory');
  }
  if (!isset($options['client_id'])) {
    $options['client_id'] = $this->client_id;
  }
  if (empty($options['client_id'])) {
    throw new ApiException('client_id is mandatory');
  }
  $options['refresh_token'] = $refresh_token;
  $options['grant_type'] = 'refresh_token';
  return $this
    ->oauth_token($options);
}