You are here

public function AuthTokenProvider::getAccessToken in TMGMT Translator Smartling 8.2

Same name in this branch
  1. 8.2 api-sdk-php/src/AuthApi/AuthTokenProvider.php \Smartling\AuthApi\AuthTokenProvider::getAccessToken()
  2. 8.2 vendor/smartling/api-sdk-php/src/AuthApi/AuthTokenProvider.php \Smartling\AuthApi\AuthTokenProvider::getAccessToken()
Same name and namespace in other branches
  1. 8.4 vendor/smartling/api-sdk-php/src/AuthApi/AuthTokenProvider.php \Smartling\AuthApi\AuthTokenProvider::getAccessToken()
  2. 8.3 vendor/smartling/api-sdk-php/src/AuthApi/AuthTokenProvider.php \Smartling\AuthApi\AuthTokenProvider::getAccessToken()

@inheritdoc

File

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

Class

AuthTokenProvider
Class AuthTokenProvider @package Smartling\AuthApi

Namespace

Smartling\AuthApi

Code

public function getAccessToken() {
  if (!$this
    ->tokenExists()) {
    $this->requestTimestamp = time();
    $this->data = $this
      ->authenticate();
  }
  if ($this
    ->tokenExpired()) {
    $this
      ->tokenRenew();
  }
  return $this->data[self::RESPONSE_KEY_ACCESS_TOKEN];
}