diff --git a/src/oauth/ZohoOAuthClient.php b/src/oauth/ZohoOAuthClient.php index 4cd62131..2b871735 100644 --- a/src/oauth/ZohoOAuthClient.php +++ b/src/oauth/ZohoOAuthClient.php @@ -158,7 +158,7 @@ public function getUserEmailIdFromIAM($accessToken) $connector->addHeadder(ZohoOAuthConstants::AUTHORIZATION, ZohoOAuthConstants::OAUTH_HEADER_PREFIX . $accessToken); $apiResponse = $connector->get(); $jsonResponse = self::processResponse($apiResponse); - if(!array_key_exists("Email", $jsonResponse)){ + if(!is_array($jsonResponse) || !array_key_exists("Email", $jsonResponse)){ throw new ZohoOAuthException("Exception while fetching UserID from access token, Make sure AAAserver.profile.Read scope is included while generating the Grant token " . $jsonResponse); } return $jsonResponse['Email']; @@ -171,4 +171,4 @@ public function processResponse($apiResponse) return $jsonResponse; } -} \ No newline at end of file +}