These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

/oauth/token throwing internal server error

Author
rusherz
Federal Navy Academy
Gallente Federation
#1 - 2016-11-18 19:30:19 UTC
This is the first time I'm trying to work with SSO so it is possibly(most likely) something that I've done wrong

Getting the authentication code works fine, when I go to validate the code I get a HTTP 500 error.

This is how I am trying to post:

$myRequest = curl_init($url);
curl_setopt($myRequest, CURLOPT_POST, TRUE);
curl_setopt($myRequest, CURLOPT_RETURNTRANSFER, 1);
$headr = array();
$headr[] = 'Content-Type: application/json';
$headr[] = 'Authorization: "Basic "' . base64_encode("clientID:secret");
$headr[] = 'Host: login.eveonline.com';
$param = array(
'grant_type' => 'authorization_code',
'code' => $code
);
$param = json_encode($param);
$headr[] = 'Content-Length: ' . strlen($param);
curl_setopt($myRequest, CURLOPT_HTTPHEADER, $headr);
curl_setopt($myRequest, CURLOPT_POSTFIELDS, $param);
$response = curl_exec($myRequest);
$statusCode = curl_getinfo($myRequest, CURLINFO_HTTP_CODE);
curl_close($myRequest);

ClientID and Secret are both typed so they can be in the quotes. I'm not sure what I am doing wrong.

Side note I couldnt get the code brackets to work with code maybe a dev can edit this or someone can explain how to put the code in formatting..
David Davaham
Deep Blue Logistics
#2 - 2016-11-19 03:56:56 UTC
http://eveonline-third-party-documentation.readthedocs.io/en/latest/sso/authentication.html

According to the Doc, you need to send a Content-Type Header of application/x-www-form-urlencoded. I see you sending application/json.

Developer of EVEmail