Skip to content

Commit

Permalink
Exception will be thrown if response doesn't contain 'Email' key for
Browse files Browse the repository at this point in the history
User info url using grant token
  • Loading branch information
pravesh-a committed May 7, 2020
1 parent 63690f4 commit 5658154
Showing 1 changed file with 3 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 @@ -158,7 +158,9 @@ 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)){
throw new ZohoOAuthException("Exception while fetching UserID from grant token, Make sure AAAserver.profile.Read scope is included while generating the Grant token " . $jsonResponse);
}
return $jsonResponse['Email'];
}

Expand Down

0 comments on commit 5658154

Please sign in to comment.