You are here

private function AuthTokenProvider::tokenRenew in TMGMT Translator Smartling 8.2

Same name in this branch
  1. 8.2 api-sdk-php/src/AuthApi/AuthTokenProvider.php \Smartling\AuthApi\AuthTokenProvider::tokenRenew()
  2. 8.2 vendor/smartling/api-sdk-php/src/AuthApi/AuthTokenProvider.php \Smartling\AuthApi\AuthTokenProvider::tokenRenew()

Renews tokens

2 calls to AuthTokenProvider::tokenRenew()
AuthTokenProvider::getAccessToken in api-sdk-php/src/AuthApi/AuthTokenProvider.php
@inheritdoc
AuthTokenProvider::getAccessToken in vendor/smartling/api-sdk-php/src/AuthApi/AuthTokenProvider.php
@inheritdoc

File

api-sdk-php/src/AuthApi/AuthTokenProvider.php, line 142

Class

AuthTokenProvider
Class AuthTokenProvider @package Smartling\AuthApi

Namespace

Smartling\AuthApi

Code

private function tokenRenew() {
  if ($this
    ->tokenExists() && $this
    ->tokenCanBeRenewed()) {
    $requestData = $this
      ->getDefaultRequestData('json', [
      'refreshToken' => $this->data[self::RESPONSE_KEY_REFRESH_TOKEN],
    ], false);
    return $this
      ->sendRequest('authenticate/refresh', $requestData, self::HTTP_METHOD_POST);
  }
  else {
    return $this
      ->authenticate();
  }
}