# ESI: Unknown grant\_type while trying to get access token

**URL:** <https://forums.eveonline.com/t/esi-unknown-grant-type-while-trying-to-get-access-token/98705>\
**Category:** Third Party Developers\
**Created:** [August 17, 2018, 2:35pm UTC](https://forums.eveonline.com/t/esi-unknown-grant-type-while-trying-to-get-access-token/98705 "2018-08-17T14:35:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![n2k](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/n2k/32/102423_2.png) [@n2k](https://forums.eveonline.com/u/n2k)\
**Post date:** [August 17, 2018, 2:35pm UTC](https://forums.eveonline.com/t/esi-unknown-grant-type-while-trying-to-get-access-token/98705/1 "2018-08-17T14:35:30Z")

</div>

Hi folks o/

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

[https://developers.eveonline.com/blog/article/sso-to-authenticated-calls](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

---

<div class="post-metadata">

**Author:** ![EveDataRules](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/evedatarules/32/52946_2.png) [@EveDataRules](https://forums.eveonline.com/u/EveDataRules)\
**Post date:** [August 17, 2018, 4:51pm UTC](https://forums.eveonline.com/t/esi-unknown-grant-type-while-trying-to-get-access-token/98705/2 "2018-08-17T16:51:51Z")

</div>

grant\_type:authorization\_code

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

---

<div class="post-metadata">

**Author:** ![n2k](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/n2k/32/102423_2.png) [@n2k](https://forums.eveonline.com/u/n2k)\
**Post date:** [August 21, 2018, 12:02pm UTC](https://forums.eveonline.com/t/esi-unknown-grant-type-while-trying-to-get-access-token/98705/3 "2018-08-21T12:02:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/eveonline/original/3X/4/1/41ec4921cbaca7a6f9ea556e7cc20018461eae5e.png) [@system](https://forums.eveonline.com/u/system)\
**Post date:** [November 19, 2018, 12:02pm UTC](https://forums.eveonline.com/t/esi-unknown-grant-type-while-trying-to-get-access-token/98705/4 "2018-11-19T12:02:11Z")

</div>

Closed on November 19, 2018, 12:02pm UTC

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