private function BaseApiAbstract::checkAuthenticationError in TMGMT Translator Smartling 8.4
Same name and namespace in other branches
- 8.2 api-sdk-php/src/BaseApiAbstract.php \Smartling\BaseApiAbstract::checkAuthenticationError()
- 8.2 vendor/smartling/api-sdk-php/src/BaseApiAbstract.php \Smartling\BaseApiAbstract::checkAuthenticationError()
- 8.3 vendor/smartling/api-sdk-php/src/BaseApiAbstract.php \Smartling\BaseApiAbstract::checkAuthenticationError()
Parameters
Response $response:
Throws
1 call to BaseApiAbstract::checkAuthenticationError()
- BaseApiAbstract::sendRequest in vendor/
smartling/ api-sdk-php/ src/ BaseApiAbstract.php
File
- vendor/
smartling/ api-sdk-php/ src/ BaseApiAbstract.php, line 358
Class
- BaseApiAbstract
- Class BaseApiAbstract
Namespace
SmartlingCode
private function checkAuthenticationError(Response $response) {
//Special handling for 401 error - authentication error => expire token
if (401 === (int) $response
->getStatusCode()) {
if (!$this
->getAuth() instanceof AuthApiInterface) {
$type = gettype($this
->getAuth());
if ('object' === $type) {
$type .= '::' . get_class($this
->getAuth());
}
throw new SmartlingApiException('AuthProvider expected to be instance of AuthApiInterface, type given:' . $type, 401);
}
else {
$this
->getAuth()
->resetToken();
}
}
}