# ESI error: token not valid for scope

**URL:** <https://forums.eveonline.com/t/esi-error-token-not-valid-for-scope/335995>\
**Category:** Third Party Developers\
**Created:** [November 9, 2021, 11:25pm UTC](https://forums.eveonline.com/t/esi-error-token-not-valid-for-scope/335995 "2021-11-09T23:25:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joshua\_Keno](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/joshua_keno/32/295829_2.png) [@Joshua\_Keno](https://forums.eveonline.com/u/Joshua_Keno)\
**Post date:** [November 9, 2021, 11:25pm UTC](https://forums.eveonline.com/t/esi-error-token-not-valid-for-scope/335995/1 "2021-11-09T23:25:31Z")

</div>

I am working on a Java ESI client application using the library published on GitHub (net.troja.eve.esi) in v4.1.0. I can connect to ESI, generate the access credentials and successfully execute calls that do not need scope access. However, whenever I try to access a protected endpoint (like read character location) I get the error that the token is not valid for the requested scope. My application definition contains the requested scope, but somehow the backend does not recognize that.  
What does not seem to work properly is the authentication process when I generate the refresh token. Although I have added several scopes to the list in the application definition, I am not requested to confirm these scopes when I login and generate the intermediate value to get a token.  
What am I getting wrong?

---

<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 9, 2021, 11:37pm UTC](https://forums.eveonline.com/t/esi-error-token-not-valid-for-scope/335995/2 "2021-11-09T23:37:12Z")

</div>

Without example code/errors it’s almost impossible to say. It’d suggest reading [OAuth 2.0 for Web Based Applications | esi-docs](https://docs.esi.evetech.net/docs/sso/web_based_sso_flow.html) and making sure you/your library is following each step correctly.

Possibly could go thru the process manually to get familiar with it in order to figure out what part things are breaking down.

---

<div class="post-metadata">

**Author:** ![Joshua\_Keno](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/joshua_keno/32/295829_2.png) [@Joshua\_Keno](https://forums.eveonline.com/u/Joshua_Keno)\
**Post date:** [November 9, 2021, 11:53pm UTC](https://forums.eveonline.com/t/esi-error-token-not-valid-for-scope/335995/3 "2021-11-09T23:53:25Z")

</div>

Checking the URL that was called to generate the token helped. It did not contain the scopes, because they had to be added explicitly in the code that constructs the URL. I was not aware that the scopes are taken from the local parameters and not from the ones that are defined in the application definition on the CCP website.  
Anyway, thanks for the reply, got me on the right track.

---

<div class="post-metadata">

**Author:** ![Steve\_Ronuken](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/steve_ronuken/32/373894_2.png) [@Steve\_Ronuken](https://forums.eveonline.com/u/Steve_Ronuken)\
**Post date:** [November 10, 2021, 12:04am UTC](https://forums.eveonline.com/t/esi-error-token-not-valid-for-scope/335995/4 "2021-11-10T00:04:56Z")

</div>

The ones defined in the application definition are what the application is _allowed_ to request.

Bear in mind that you can change the definition after tokens are created. This doesn’t magically give you the new scopes on the old tokens.

---

<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:** [November 18, 2021, 11:29am UTC](https://forums.eveonline.com/t/esi-error-token-not-valid-for-scope/335995/5 "2021-11-18T11:29:15Z")

</div>

@Joshua_Keno  
If you need additional help with this, please make an issue on [GitHub](https://github.com/burberius/eve-esi/issues). We do not provide help on this forum. Be sure to include your own code, so, we can get an idea of what you’re doing wrong.

---

<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 16, 2022, 11:29am UTC](https://forums.eveonline.com/t/esi-error-token-not-valid-for-scope/335995/6 "2022-02-16T11:29:29Z")

</div>

Closed on February 16, 2022, 11:29am UTC

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