вот код
Код: Выделить всё
public function createAccessToken(){
$this->clientId = Config::get('constants.ZOHO_CRM_CLIENT_ID');
$this->clientSecretId = Config::get('constants.ZOHO_CRM_CLIENT_SECRET_ID');
$this->redirectUri = Config::get('constants.ZOHO_CRM_REDIRECT_URI');
$this->currentUserEmail = Config::get('constants.ZOHO_CRM_USER_EMAIL');
$this->tokenPersistancePath = public_path('zcrm_oauthtokens');
$configuration = [
"client_id" => $this->clientId ,
"client_secret"=>$this->clientSecretId,
"redirect_uri"=>$this->redirectUri,
"currentUserEmail"=>$this->currentUserEmail,
'token_persistence_path' => $this->tokenPersistancePath,
'sandbox' => false,
'apiBaseUrl' => 'www.zohoapis.com'
];
$result = false;
try {
ZCRMRestClient::initialize($configuration);
$oAuthClient = ZohoOAuth::getClientInstance();
$refreshToken = "xxx-a0";
$userIdentifier = $this->currentUserEmail;
$oAuthTokens = $oAuthClient->generateAccessTokenFromRefreshToken($refreshToken,$userIdentifier);
$result = true;
return $oAuthTokens->getAccessToken();
} catch (\Exception $ex) {
$result = false;
}
return $result;
}
Подробнее здесь: https://stackoverflow.com/questions/788 ... update-3-0
Мобильная версия