ESI: Unknown grant_type while trying to get access token

Hi folks o/

I’m playing around with ESI API and following this tutorial:

https://developers.eveonline.com/blog/article/sso-to-authenticated-calls

Receiving the authorization token works fine. But when I try to get the access token I get the following response:

{“error”:“invalid_request”,“error_description”:“Unknown grant_type”}

My request (using curl) looks like the following:

.\curl -XPOST -H "Content-Type:application/x-www-form-urlencoded" \
-H "Authorization:Basic MyEncodedBasicAuth" \
-d 'grant_type=code&code=MN2jgZxAXHF...cqnq3fUCDLhj0' \
https://login.eveonline.com/oauth/token -k

The value of “code” is shortend in the snippet above (so the 3 dots are not part of the original request).

Edit: where “MyEncodedBasicAuth” is base64({client_id}:{secret})

As far as I know the value “code” should be used as grant_type.

I also tried the variant using the json content-type like described in the tutorial mentioned above. But this gives me internal server error. In another forum post here it was mentioned using x-www-form-urlencoded instead of json. So, I did but now getting the error “unknown grant_type”.

Anybody an idea what I’m doing wrong?

Thanks in advance.

BR
n2k

grant_type:authorization_code

Also use a library to handle oauth2 SSO, it will save you so many headaches.

Hi,

thanks for response. It works. I missed this.

Yep, sure. I’ll go for oauth2 lib later. For now just playing around using curl.

Thanks!

BR
n2k

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.