Skip to content

Commit

Permalink
Handled the new oauth response
Browse files Browse the repository at this point in the history
  • Loading branch information
pravesh-a committed Nov 18, 2019
1 parent 168de63 commit d108aa8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/oauth/ZohoOAuthClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,10 @@ private function getTokensFromJSON($responseObj)
{
$oAuthTokens = new ZohoOAuthTokens();
$expiresIn = $responseObj[ZohoOAuthConstants::EXPIRES_IN];
if(!array_key_exists(ZohoOAuthConstants::EXPIRES_IN_SEC,$responseObj)){
$expiresIn=$expiresIn*1000;
}
$oAuthTokens->setExpiryTime($oAuthTokens->getCurrentTimeInMillis() + $expiresIn);

$accessToken = $responseObj[ZohoOAuthConstants::ACCESS_TOKEN];
$oAuthTokens->setAccessToken($accessToken);
if (array_key_exists(ZohoOAuthConstants::REFRESH_TOKEN, $responseObj)) {
Expand Down
2 changes: 2 additions & 0 deletions src/oauth/utility/ZohoOAuthConstants.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class ZohoOAuthConstants

const EXPIRES_IN = "expires_in";

const EXPIRES_IN_SEC = "expires_in_sec";

const EXPIRIY_TIME = "expiry_time";

const PERSISTENCE_HANDLER_CLASS = "persistence_handler_class";
Expand Down

0 comments on commit d108aa8

Please sign in to comment.