# \[Elixir\] Token verification

**URL:** <https://forums.eveonline.com/t/elixir-token-verification/155735>\
**Category:** Third Party Developers\
**Created:** [April 29, 2019, 5:58am UTC](https://forums.eveonline.com/t/elixir-token-verification/155735 "2019-04-29T05:58:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Black\_Madness](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/black_madness/32/410292_2.png) [@Black\_Madness](https://forums.eveonline.com/u/Black_Madness)\
**Post date:** [April 29, 2019, 5:58am UTC](https://forums.eveonline.com/t/elixir-token-verification/155735/1 "2019-04-29T05:58:31Z")

</div>

Hi, i am creating a personal tool that uses ESI. The UI is in react, so i am using the implicit flow approach. When i obtain the code, i try to verify it but i obtain a

```auto
Response: %HTTPoison.Response{
  body: "{\"error\":\"invalid_request\",\"error_description\":\"Unknown grant_type .\"}",
  headers: [
    {"Cache-Control", "no-cache"},
    {"Pragma", "no-cache"},
    {"Content-Type", "application/json; charset=utf-8"},
    {"Expires", "-1"},
    {"Server", "Microsoft-IIS/10.0"},
    {"Content-Security-Policy",
     "default-src 'self'; img-src 'self' data: *.facebook.com image.eveonline.com web.ccpgamescdn.com; font-src 'self' web.ccpgamescdn.com fonts.gstatic.com; style-src 'self' 'unsafe-inline' web.ccpgamescdn.com hello.myfonts.net; script-src 'self' 'XXXX' connect.facebook.net az416426.vo.msecnd.net; connect-src dc.services.visualstudio.com; frame-ancestors launcher.testeveonline.com launcher.eveonline.com; frame-src connect.facebook.net www.facebook.com; report-uri https://ccpgames.report-uri.com/r/t/csp/enforce"},
    {"Report-To",
     "{'group':'default','max_age':31536000,'endpoints':[{'url':'https://ccpgames.report-uri.com/a/t/g'}],'include_subdomains':true}"},
    {"NEL",
     "{'report_to':'default','max_age':31536000,'include_subdomains':true}'"},
    {"Date", "Mon, 29 Apr 2019 05:36:10 GMT"},
    {"Content-Length", "70"}
  ],
  request: %HTTPoison.Request{
    body: "{\"code\":\"XXXXXX\",\"grant_type\":\"authorization_code\"}",
    headers: [
      {"Authorization",
       "Basic XXXXX"},
      {"Content-Type", "application/x-www-form-urlencoded"},
      {"Host", "login.eveonline.com"}
    ],
    method: :post,
    options: [],
    params: %{},
    url: "https://login.eveonline.com/oauth/token"
  },
  request_url: "https://login.eveonline.com/oauth/token",
  status_code: 400
}

```

Apparently the call is well forged, but i am having 400, _unknown grant\_type_, which clearly tells me the opposite. What am i doing wrong ? HTTPoison use ?

Thanks

---

<div class="post-metadata">

**Author:** ![Blacksmoke16](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/blacksmoke16/32/376589_2.png) [@Blacksmoke16](https://forums.eveonline.com/u/Blacksmoke16)\
**Post date:** [April 29, 2019, 12:32pm UTC](https://forums.eveonline.com/t/elixir-token-verification/155735/2 "2019-04-29T12:32:04Z")

</div>

Well for one it looks like you’re setting your content type to form-urlencoded yet sending a JSON body?

Also if you switch to the v2 OAuth endpoints, you could validate your token locally using a JWT lib.

> **[OAuth 2.0 for Web Based Applications](https://docs.esi.evetech.net/docs/sso/web_based_sso_flow.html)**
>
> The official repository for ESI documentation

  

> **[Validating JWT tokens from the EVE SSO](https://docs.esi.evetech.net/docs/sso/validating_eve_jwt.html)**
>
> The official repository for ESI documentation

---

<div class="post-metadata">

**Author:** ![Golden\_Gnu](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/golden_gnu/32/459734_2.png) [@Golden\_Gnu](https://forums.eveonline.com/u/Golden_Gnu)\
**Post date:** [April 29, 2019, 1:04pm UTC](https://forums.eveonline.com/t/elixir-token-verification/155735/3 "2019-04-29T13:04:15Z")

</div>

Please, note that sending the auth as a json body is not part of the official OAuth2 specs, so, it may be removed in the future, so, you’re better off using headers, as that is the standard approach; See documentation for how to do that with [v1](https://eveonline-third-party-documentation.readthedocs.io/en/latest/sso/authentication.html#verify-the-authorization-code) or [v2](https://github.com/esi/esi-docs#sso---read-this-notice-first)

---

<div class="post-metadata">

**Author:** ![Black\_Madness](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/black_madness/32/410292_2.png) [@Black\_Madness](https://forums.eveonline.com/u/Black_Madness)\
**Post date:** [April 29, 2019, 1:45pm UTC](https://forums.eveonline.com/t/elixir-token-verification/155735/4 "2019-04-29T13:45:00Z")

</div>

I am passing proper Content-Type header, but effectively looks like the payload is being encoded in json …

---

<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:** [July 28, 2019, 1:45pm UTC](https://forums.eveonline.com/t/elixir-token-verification/155735/5 "2019-07-28T13:45:04Z")

</div>

Closed on July 28, 2019, 1:45pm UTC

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