I want to access zoho APIs, but when I try to get access token then give error invalid client. My code is as follows:
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://accounts.zoho.com/oauth/v2/token',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('client_id' => 'xxxxxxx','client_secret' =>
'xxxxxx','redirect_uri' => 'https://mailedforme.com/','grant_type' => 'access_token'),
CURLOPT_HTTPHEADER => array(
'Cookie: JSESSIONID=AFBA9977A8E26493C2CDF129CA3A3689; _zcsr_tmp=f353c6a1-d9bd-4877-abad-
4cbb67a6a797; b266a5bf57=a7f15cb1555106de5ac96d088b72e7c8; iamcsr=f353c6a1-d9bd-4877-abad-
4cbb67a6a797'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Result is:
{"error":"invalid_client"}