Closed bab2k84 closed 5 years ago
I'm unable to request a token from https://login.eveonline.com/v2/oauth/token I recieve the below response.
{"error":"invalid_grant","error_description":"Grant type is not supported."}
I'm using PHP to make a CURL request to the server but can't seem to work out where the error is in my code - See Below
$headers = [ 'Authorization: Basic ' . base64_encode(self::$credentials['clientId'] . ':' . self::$credentials['secretKey']), 'Content-Type: application/x-www-form-urlencoded', ];
// Seems like CCP does not mind JSON in the body. Yay. $fields = json_encode([ 'grant_type' => 'authorization_code', 'code' => $code, ]); // Start a cURL session $ch = curl_init('https://login.eveonline.com/v2/oauth/token'); curl_setopt_array($ch, [ CURLOPT_URL => 'https://login.eveonline.com/v2/oauth/token', CURLOPT_POST => true, CURLOPT_POSTFIELDS => '?grant_type=authorization_code&code='.$code, CURLOPT_HTTPHEADER => $headers, CURLOPT_RETURNTRANSFER => true, ] ); $result = curl_exec($ch);
Any help would be greatly appreciated Thanks
Please remove the question mark in post fields. Example: CURLOPT_POSTFIELDS => "grant_type=authorization_code&code=".$code,
CURLOPT_POSTFIELDS => "grant_type=authorization_code&code=".$code,
Bug
I'm unable to request a token from https://login.eveonline.com/v2/oauth/token I recieve the below response.
{"error":"invalid_grant","error_description":"Grant type is not supported."}
I'm using PHP to make a CURL request to the server but can't seem to work out where the error is in my code - See Below
$headers = [ 'Authorization: Basic ' . base64_encode(self::$credentials['clientId'] . ':' . self::$credentials['secretKey']), 'Content-Type: application/x-www-form-urlencoded', ];
Any help would be greatly appreciated Thanks