I have done as per document, let me know what doing wrong. Access token, refresh token, expiry_time is storing in database but dont know how to send this refresh token to get access token.
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
use zcrmsdk\crm\crud\ZCRMModule;
use zcrmsdk\crm\setup\org\ZCRMOrganization;
use zcrmsdk\oauth\ZohoOAuth;
require 'vendor/autoload.php';
use App\Oauthtokens;
class CRMController extends Controller
{
public function __construct()
{
$configuration=array(
"client_id"=>"1000.XXXXXXXXXXXXXXXXXXXX",
"client_secret"=>"XXXXXXXXXXXXXXXXXXXXX",
"redirect_uri"=>"redirect_url",
"currentUserEmail"=>"my_zoho_mail_id",
//"token_persistance_path"=>"file_path",
"sandbox"=>"false",
"access_type"=>"offline",
//"persistence_handler_class"=>"ZohoOAuthPersistenceHandler",
"applicationLogFilePath"=>"file_path",
"userIdentifier"=>"my_zoho_mail_id",
);
//access token from grant token
ZCRMRestClient::initialize($configuration);
$oAuthClient = ZohoOAuth::getClientInstance();
$grantToken = "1000.b69cdd631109696285dab61223af8599.8328954eb74964a7b174e2c4d35af6ad";
$oAuthTokens = $oAuthClient->generateAccessToken($grantToken);
}
public function getUser(){
try{
$token = Oauthtokens::orderby('id','desc')->first();
$refreshToken = $token->refreshtoken;
$zcrmModuleIns = ZCRMModule::getInstance("Customers");
$bulkAPIResponse=$zcrmModuleIns->getRecords();
$recordsArray = $bulkAPIResponse->getData(); // $recordsArray - array of ZCRMRecord instances
return $recordsArray;
}catch(ZohoOAuthException $e){
return $e;
}
}
}