You are here

private function AuthTokenProvider::refreshToken in TMGMT Translator Smartling 8.4

Same name and namespace in other branches
  1. 8.3 vendor/smartling/api-sdk-php/src/AuthApi/AuthTokenProvider.php \Smartling\AuthApi\AuthTokenProvider::refreshToken()

Renews tokens

1 call to AuthTokenProvider::refreshToken()
AuthTokenProvider::getAccessToken in vendor/smartling/api-sdk-php/src/AuthApi/AuthTokenProvider.php
@inheritdoc

File

vendor/smartling/api-sdk-php/src/AuthApi/AuthTokenProvider.php, line 161

Class

AuthTokenProvider
Class AuthTokenProvider @package Smartling\AuthApi

Namespace

Smartling\AuthApi

Code

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