Hello there,
I have started using (trying to) the new API, and I am a bit confused as I am getting an error which is not an error. I am running the following code in my machine:
$bodyData = array(
"grant_type" => "authorization_code",
"code" => $code);
$headerData = array(
"Authorization:Basic " . base64_encode(clientID.":".secretKey),
"Content-Type:application/json",
'Host:login.eveonline.com'
);
$curl = curl_init();
$url = 'https://login.eveonline.com/v2/oauth/token/';
$certificate = "C:\wamp64\certs\cacert.pem";
curl_setopt($curl, CURLOPT_CAINFO, $certificate);
curl_setopt($curl, CURLOPT_CAPATH, $certificate);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($bodyData));
curl_setopt($curl, CURLOPT_HTTPHEADER, $headerData);
$response = curl_exec($curl);
if( $response === false){
echo 'Curl error: ' . curl_error($curl);
}
else{
echo $response;
}
This was supposed to complete the step two in the authorization but, although the curl command is not generating any error, the response I am getting is:
{ "Message" : "An error has occurred." }
I am not sure what I am doing wrong and unfortunately Google has not been of great help until now.
I tried to run the same from the command line as
curl -XPOST -H "Content-Type:application/json" -H "Authorization:Basic ZWRlODdiOWIzZGMyNGR...SE1mREpYTFlDNWVjRkptSGQwMFlzWUc4MXpETU9vcDZIYmZYeg==" -d '{"grant_type":"authorization_code", "code":"DKVHTD6MQXt-t9YNe4SVD8ATe...mwl0NBVo35uImZG9IxbHhhjda"}' https://login.eveonline.com/v2/oauth/token
and got exactly the same response.
Any hint would be appreciated.
Thanks a lot!
GK