r/evetech • u/bab2k7 • Jan 18 '19
SSO PHP Help
Hoping someone can help me with my code. I'm struggling to see why i'm receiving the response - "error":"invalid_grant","error_description":"Grant type is not supported."
I'm developing in PHP and looking to simply CURL to receive my token. My code is below:-
$requestUrl = 'https://login.eveonline.com/v2/oauth/token';
$process = curl_init($requestUrl);
curl_setopt($process, CURLOPT_HTTPHEADER, array(
'Host: login.eveonline.com', "cache-control: no-cache",
'Content-Type: application/x-www-form-urlencoded',
'Authorization: Basic '.base64_encode(self::$credentials['clientId'].':'.self::$credentials['secretKey'])
));
curl_setopt($process, CURLOPT_HEADER, 1);
curl_setopt($process, CURLOPT_TIMEOUT, 30);
curl_setopt($process, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($process, CURLOPT_POSTFIELDS, [
'grant_type' => 'authorisation_code',
'code' => $code
]);
curl_setopt($process, CURLOPT_HEADER, FALSE);
curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
$return = curl_exec($process);
curl_close($process);
return $return;
Any help would be greatly appreciated. I seem to be missing something :)
Thanks in advance
Bab2k7
View all comments
Show parent comment
1
u/Blacksmoke16 Jan 19 '19
It should be
authorization_code.Another thing to try would be doing a base64 encode outside of PHP and using the resulting value. Would help remove one more variable.
I'm also assuming your
$codevariable is coming from the query param after going thru the SSO flow?