Hi all.
I started to develop a small web based (php) application using the ESI API. Here is my code right now.
<?php
$authcode = base64_encode("{CLIENT_ID}:{SECRET_KEY}");
$data = array("grant_type" => "authorization_code", "code" => $_GET["code"]);
$data_string = json_encode($data);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://login.eveonline.com/v2/oauth/token");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, array("Content-Type:application/json", "Authorization:Basic " . $authcode));
$result = curl_exec($ch);
if (curl_error($ch))
{
$error_msg = curl_error($ch);
print_r($error_msg);
}
curl_close($ch);
print_r($result);
?>
And this is my output…
HTTP/1.1 401 Unauthorized Cache-Control: no-cache Pragma: no-cache Content-Length: 87 Content-Type: application/json; charset=utf-8 Expires: -1 Server: Microsoft-IIS/8.5 Date: Fri, 14 Dec 2018 21:11:59 GMT {“error”:“invalid_client”,“error_description”:“Missing or invalid client credentials.”}
Any help will be appreciated.