CURL validate authcode error

Hi,

 

I am submitting the auth_code for generating access token but getting the following error

 

{"s": "error", "code": 500, "message": "Looks like you are passing an invalid entry"}1

 

please help.

 

my code

 

$postRequest = array(

"grant_type" => "authorization_code",

"appIdHash" => "5c074a1c2d40407fe31512ac8df10f0416235b809565c2b8f50f27c*******",

"code" => $auth_code

);


$headers = array(

"Content-Type" => "application/json",

);


$cURLConnection = curl_init('https://api.fyers.in/api/v2/validate-authcode');

curl_setopt($cURLConnection, CURLOPT_POSTFIELDS, $postRequest);

curl_setopt($cURLConnection, CURLOPT_RETURNTRANSFER, true);

curl_setopt($cURLConnection, CURLOPT_HTTPHEADER, $headers);

 

$apiResponse = curl_exec($cURLConnection);

curl_close($cURLConnection);

 

// $apiResponse - available data from the API request

$jsonArrayResponse = json_decode($apiResponse);

print_r($jsonArrayResponse);

 

1 reply