# Sso post err

**URL:** <https://forums.eveonline.com/t/sso-post-err/354223>\
**Category:** Third Party Developers\
**Created:** [March 17, 2022, 8:28pm UTC](https://forums.eveonline.com/t/sso-post-err/354223 "2022-03-17T20:28:01Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karan\_Care](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/karan_care/32/312338_2.png) [@Karan\_Care](https://forums.eveonline.com/u/Karan_Care)\
**Post date:** [March 17, 2022, 8:28pm UTC](https://forums.eveonline.com/t/sso-post-err/354223/1 "2022-03-17T20:28:01Z")

</div>

Im using openresty  
When I get the authorization code, I always get an error 404 when I send a post request to sso.

 ![image](https://global.discourse-cdn.com/eveonline/original/4X/a/1/0/a10165c4dc0a1357c6e83551110227c932018d50.png)

openresty log:  
2022/03/18 04:13:25 [debug] 29706#0: \*63 [lua] http.lua:638: send\_request(): {“body”:“grant\_type%3Dauthorization\_code%26code%3Dmycode”,“path”:"/v2/oauth/toke",“headers”:{“Content-Length”:63,“Authorization”:“Basic somestring”,“User-Agent”:“lua-resty-http/0.12 (Lua) ngx\_lua/10020”,“Host”:“[login.eveonline.com](http://login.eveonline.com)”,“Content-Type”:“application/x-www-form-urlencoded”},“query”:"",“method”:“POST”}  
2022/03/18 04:13:26 [debug] 29706#0: \*63 [lua] callback.lua:61: [https://login.eveonline.com/v2/oauth/toke](https://login.eveonline.com/v2/oauth/toke)

where is the error  
Thanks for the kind help

---

<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:** [March 18, 2022, 1:15am UTC](https://forums.eveonline.com/t/sso-post-err/354223/2 "2022-03-18T01:15:24Z")

</div>

Looks like you’re missing the `n` on your request URI. I.e. `/v2/oauth/token` not `/v2/oauth/toke`.

---

<div class="post-metadata">

**Author:** ![Karan\_Care](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/karan_care/32/312338_2.png) [@Karan\_Care](https://forums.eveonline.com/u/Karan_Care)\
**Post date:** [March 18, 2022, 1:32am UTC](https://forums.eveonline.com/t/sso-post-err/354223/3 "2022-03-18T01:32:38Z")

</div>

thank you for your seriousness  
while i change th URI, it returned as 400 {“error”:“invalid\_grant”,“error\_description”:“Grant type is not supported.”}

---

<div class="post-metadata">

**Author:** ![Karan\_Care](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/karan_care/32/312338_2.png) [@Karan\_Care](https://forums.eveonline.com/u/Karan_Care)\
**Post date:** [March 18, 2022, 1:33am UTC](https://forums.eveonline.com/t/sso-post-err/354223/4 "2022-03-18T01:33:10Z")

</div>

thank you for your seriousness  
while i change th URI, it returned as 400 {“error”:“invalid\_grant”,“error\_description”:“Grant type is not supported.”}

---

<div class="post-metadata">

**Author:** ![Karan\_Care](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/karan_care/32/312338_2.png) [@Karan\_Care](https://forums.eveonline.com/u/Karan_Care)\
**Post date:** [March 18, 2022, 1:34am UTC](https://forums.eveonline.com/t/sso-post-err/354223/5 "2022-03-18T01:34:45Z")

</div>

I was always stuck here 400 before

---

<div class="post-metadata">

**Author:** ![Karan\_Care](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/karan_care/32/312338_2.png) [@Karan\_Care](https://forums.eveonline.com/u/Karan_Care)\
**Post date:** [March 18, 2022, 2:05am UTC](https://forums.eveonline.com/t/sso-post-err/354223/6 "2022-03-18T02:05:35Z")

</div>

curl -XPOST -v -H “Content-Type:application/x-www-form-urlencoded” -H “Authorization:Basic url\_safe\_base64\_string” -d ‘grant\_type=authorization\_code&code=X00WzkDmt0W86MpDVMWWgA’ [https://login.eveonline.com/v2/oauth/token](https://login.eveonline.com/v2/oauth/token)

return {“error”:“invalid\_grant”,“error\_description”:“Grant type authorization\_code is not supported.”}

curl -XPOST -v -H “Content-Type:application/x-www-form-urlencoded” -H “Authorization:Basic url\_safe\_base64\_string” -d ‘grant\_type%3Dauthorization\_code%26code%3DX00WzkDmt0W86MpDVMWWgA’ [https://login.eveonline.com/v2/oauth/token](https://login.eveonline.com/v2/oauth/token)

return {“error”:“invalid\_grant”,“error\_description”:“Grant type is not supported.”}

where is the diff? and why

---

<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:** [March 18, 2022, 2:16am UTC](https://forums.eveonline.com/t/sso-post-err/354223/7 "2022-03-18T02:16:28Z")

</div>

Hmm, i was able to reproduce this. Give me a few to figure it out.

---

<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:** [March 18, 2022, 2:22am UTC](https://forums.eveonline.com/t/sso-post-err/354223/8 "2022-03-18T02:22:07Z")

</div>

I think the gist of it is your authorization header isn’t right, but the error is less the clear…

To debug this, you should ensure that `base64_encode("CLIENT_ID:CLIENT_SECRET")` results in `Q0xJRU5UX0lEOkNMSUVOVF9TRUNSRVQ=`. Which might be as simple as removing the `, true` on `ngx.encode_base64`.

---

<div class="post-metadata">

**Author:** ![Karan\_Care](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/karan_care/32/312338_2.png) [@Karan\_Care](https://forums.eveonline.com/u/Karan_Care)\
**Post date:** [March 18, 2022, 2:48am UTC](https://forums.eveonline.com/t/sso-post-err/354223/9 "2022-03-18T02:48:54Z")

</div>

Thanks for your suggestion, I finally got the correct result .

[OAuth 2.0 for Web Based Applications](https://docs.esi.evetech.net/docs/sso/web_based_sso_flow.html)

```auto
Create a URL safe Base64 encoded string where the contents before encoding are your application’s client ID, followed by a :, followed by your application’s secret key (e.g. URL safe Base64(<client_id>:<secret_key>)).

```

not **URL safe Base64(\<client\_id\>:\<secret\_key\>)**, the true just is **Base64(\<client\_id\>:\<secret\_key\>)**

---

<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:** [March 19, 2022, 12:41am UTC](https://forums.eveonline.com/t/sso-post-err/354223/10 "2022-03-19T00:41:10Z")

</div>

I created a PR to make this clearer in the docs: [Clarify Auth header requirements by Blacksmoke16 · Pull Request #68 · esi/esi-docs · GitHub](https://github.com/esi/esi-docs/pull/68).

In the end I don’t think it really matters if it was URL safe or not given, in my limiting testing, doesn’t ever include those chars anyway. The crux of the problem in your case was the lack of padding.

---

<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:** [June 17, 2022, 12:41am UTC](https://forums.eveonline.com/t/sso-post-err/354223/11 "2022-06-17T00:41:45Z")

</div>

Closed on June 17, 2022, 12:41am UTC

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