# EVE API auth callback using hashtag for query strings

**URL:** <https://forums.eveonline.com/t/eve-api-auth-callback-using-hashtag-for-query-strings/119721>\
**Category:** Third Party Developers\
**Tags:** api\
**Created:** [November 11, 2018, 1:11pm UTC](https://forums.eveonline.com/t/eve-api-auth-callback-using-hashtag-for-query-strings/119721 "2018-11-11T13:11:05Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Skipp\_Doe](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/skipp_doe/32/387035_2.png) [@Skipp\_Doe](https://forums.eveonline.com/u/Skipp_Doe)\
**Post date:** [November 11, 2018, 1:11pm UTC](https://forums.eveonline.com/t/eve-api-auth-callback-using-hashtag-for-query-strings/119721/1 "2018-11-11T13:11:05Z")

</div>

Hello everyone. Hopefully i’m posting this in the correct sub-forum…

Basically, after requesting auth from the EVE API (using implicit requests since it’s a frontend JS app), the API returns a token onto my given callback URL - however, instead of using questionmarks (?) to append the actual query string - the API returns a hashtag.

So basically instead of [https://myapp.com/login?access\_token={whatever-the-access-token}](https://myapp.com/login?access_token=%7Bwhatever-the-access-token%7D) i get [https://myapp.com/login#access\_token={whatever-the-access-token}](https://myapp.com/login#access_token=%7Bwhatever-the-access-token%7D)

This doesn’t make it a valid query string when it comes to using frontend routers or the URLSearchParams() method since it can’t detect it.

Is there a way of changing this?

---

<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:** [November 11, 2018, 2:57pm UTC](https://forums.eveonline.com/t/eve-api-auth-callback-using-hashtag-for-query-strings/119721/2 "2018-11-11T14:57:41Z")

</div>

This means you are using the implicit auth mode, only way to chance it would be not using implicit mode.

> <https://stackoverflow.com/questions/49040465/urlsearchparams-fails-to-get-first-parameter-when-is-in-url/49041101#49041101>

The answer there should work as well.

---

<div class="post-metadata">

**Author:** ![Skipp\_Doe](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/skipp_doe/32/387035_2.png) [@Skipp\_Doe](https://forums.eveonline.com/u/Skipp_Doe)\
**Post date:** [November 11, 2018, 4:19pm UTC](https://forums.eveonline.com/t/eve-api-auth-callback-using-hashtag-for-query-strings/119721/3 "2018-11-11T16:19:46Z")

</div>

Implicit auth mode is the only way you can do it frontend-side according to the docs. Using the normal “code” to handshake fails due to CORS. Will take a look at the link. thnx

**Edit:** I managed to work around it by parsing the hash part of the url on my own. If anyone comes across this with the same problem here’s what i did (using Vue.js router btw):

```
const parsedParams = {};
this.$route.hash.split('&').map(part => part.replace(/#/, '')).forEach(param => {
   const parts = param.split('=')
   parsedParams[parts[0]] = parts[1]
})

```

This will return an object that looks like:

```
{ access_token: <tokenString>
   expires_in: "1199"
   state: <stateString>
   token_type: "Bearer"}
```

---

<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:** [November 11, 2018, 4:50pm UTC](https://forums.eveonline.com/t/eve-api-auth-callback-using-hashtag-for-query-strings/119721/4 "2018-11-11T16:50:42Z")

</div>

Also maybe take a look at the V2 SSO stuff, [https://github.com/esi/esi-docs/blob/master/docs/sso/native\_sso\_flow.md](https://github.com/esi/esi-docs/blob/master/docs/sso/native_sso_flow.md). Would allow you to implement the full flow without needing your client secret in the app.

---

<div class="post-metadata">

**Author:** ![Skipp\_Doe](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/skipp_doe/32/387035_2.png) [@Skipp\_Doe](https://forums.eveonline.com/u/Skipp_Doe)\
**Post date:** [November 11, 2018, 5:21pm UTC](https://forums.eveonline.com/t/eve-api-auth-callback-using-hashtag-for-query-strings/119721/5 "2018-11-11T17:21:57Z")

</div>

Yup, that’s implicit request. That’s what i’ve been using since the beginning since requesting it the “usual” way fails immediately due to CORS 🙂

Basically, you redirect the user to EVE login, and the API returns the access token back to you without handshaking and sending your app secret. The problem was API returning hash parameters instead of classic query params separated with “?” or “&”

---

<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:** [November 11, 2018, 5:57pm UTC](https://forums.eveonline.com/t/eve-api-auth-callback-using-hashtag-for-query-strings/119721/6 "2018-11-11T17:57:42Z")

</div>

But its not implicit flow. Implicit flow is when you get your token back in the callback. This method returns the code that you can use for getting a refresh token. The v2 url also has `access-control-allow-origin: *` so it should work fine doing it from your JS.

---

<div class="post-metadata">

**Author:** ![Skipp\_Doe](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/skipp_doe/32/387035_2.png) [@Skipp\_Doe](https://forums.eveonline.com/u/Skipp_Doe)\
**Post date:** [November 15, 2018, 1:10pm UTC](https://forums.eveonline.com/t/eve-api-auth-callback-using-hashtag-for-query-strings/119721/7 "2018-11-15T13:10:14Z")

</div>

Yea, I skimmed over the docs and it looked like what I’ve been using already up to the point with the new base64/sha encoded random string. Will try this out instead of using the token gotten in the callback directly.

Thnx

---

<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:** [February 13, 2019, 1:10pm UTC](https://forums.eveonline.com/t/eve-api-auth-callback-using-hashtag-for-query-strings/119721/8 "2019-02-13T13:10:14Z")

</div>

Closed on February 13, 2019, 1:10pm UTC

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