Skip to content

Commit 8541593

Browse files
committed
remove zoho crm dependency
1 parent 1f5ae42 commit 8541593

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/OAuth/Client.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77

88
namespace Zoho\Desk\OAuth;
99

10-
use zcrmsdk\crm\exception\ZCRMException;
11-
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
1210
use zcrmsdk\crm\utility\APIConstants;
13-
use zcrmsdk\crm\utility\ZCRMConfigUtil;
1411
use zcrmsdk\oauth\exception\ZohoOAuthException;
12+
use zcrmsdk\oauth\ZohoOAuth;
13+
use zcrmsdk\oauth\ZohoOAuthClient;
1514
use Zoho\Desk\Api\Metadata;
1615
use Zoho\Desk\Client\ConfigProviderInterface;
1716
use Zoho\Desk\Exception\Exception;
@@ -53,8 +52,10 @@ public function getAccessToken(): string
5352
{
5453
try {
5554
$this->configure();
56-
$accessToken = ZCRMConfigUtil::getAccessToken();
57-
} catch (ZCRMException | ZohoOAuthException $e) {
55+
/** @var ZohoOAuthClient $oauthClient */
56+
$oauthClient = ZohoOAuth::getClientInstance();
57+
$accessToken = $oauthClient->getAccessToken($this->configProvider->get()[APIConstants::CURRENT_USER_EMAIL]);
58+
} catch (ZohoOAuthException $e) {
5859
throw new Exception($e->getMessage(), $e->getCode(), $e);
5960
}
6061

@@ -69,7 +70,7 @@ public function getOrgId(): int
6970
private function configure(): void
7071
{
7172
if (!$this->isConfigured) {
72-
ZCRMRestClient::initialize($this->configProvider->get());
73+
ZohoOAuth::initialize($this->configProvider->get());
7374
$this->isConfigured = true;
7475
}
7576
}

0 commit comments

Comments
 (0)