Skip to content

Commit d108aa8

Browse files
committed
Handled the new oauth response
1 parent 168de63 commit d108aa8

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/oauth/ZohoOAuthClient.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,10 @@ private function getTokensFromJSON($responseObj)
116116
{
117117
$oAuthTokens = new ZohoOAuthTokens();
118118
$expiresIn = $responseObj[ZohoOAuthConstants::EXPIRES_IN];
119+
if(!array_key_exists(ZohoOAuthConstants::EXPIRES_IN_SEC,$responseObj)){
120+
$expiresIn=$expiresIn*1000;
121+
}
119122
$oAuthTokens->setExpiryTime($oAuthTokens->getCurrentTimeInMillis() + $expiresIn);
120-
121123
$accessToken = $responseObj[ZohoOAuthConstants::ACCESS_TOKEN];
122124
$oAuthTokens->setAccessToken($accessToken);
123125
if (array_key_exists(ZohoOAuthConstants::REFRESH_TOKEN, $responseObj)) {

src/oauth/utility/ZohoOAuthConstants.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ class ZohoOAuthConstants
4848

4949
const EXPIRES_IN = "expires_in";
5050

51+
const EXPIRES_IN_SEC = "expires_in_sec";
52+
5153
const EXPIRIY_TIME = "expiry_time";
5254

5355
const PERSISTENCE_HANDLER_CLASS = "persistence_handler_class";

0 commit comments

Comments
 (0)