Skip to content

Commit

Permalink
Merge pull request #54 from bbreukelen/isExpireFix
Browse files Browse the repository at this point in the history
Fixed issue in the isAccessTokenExpire method
  • Loading branch information
mesilov authored Sep 3, 2016
2 parents 3faaa9d + 1bec511 commit 7c85019
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/bitrix24.php
Original file line number Diff line number Diff line change
Expand Up @@ -876,11 +876,13 @@ public function isAccessTokenExpire()
// $url = 'https://'.self::OAUTH_SERVER.'/rest/app.info?auth='.$accessToken;
$url = 'https://' . $domain . '/rest/app.info?auth=' . $accessToken;
$requestResult = $this->executeRequest($url);
if (in_array($requestResult['error'], array('expired_token', 'invalid_token', 'WRONG_TOKEN'), false)) {
$isTokenExpire = true;
} else {
// handle other errors
$this->handleBitrix24APILevelErrors($requestResult, 'app.info');
if (isset($requestResult['error'])) {
if (in_array($requestResult['error'], array('expired_token', 'invalid_token', 'WRONG_TOKEN'), false)) {
$isTokenExpire = true;
} else {
// handle other errors
$this->handleBitrix24APILevelErrors($requestResult, 'app.info');
}
}
return $isTokenExpire;
}// end of isTokenExpire
Expand Down Expand Up @@ -1008,4 +1010,4 @@ public function getRetriesToConnectTimeout()
{
return $this->retriesToConnectTimeout;
}
}
}

0 comments on commit 7c85019

Please sign in to comment.