ESI Refresh Token

According to Refreshing tokens | esi-docs
“the refresh token can be stored and used indefinitely.”
This doesn’t appear to be accurate because it appears all of my users refresh tokens become unusable after 30 days?

Using EsiPy + Flask.

results = db
refresh_token = results.refresh_token

esisecurity.update_token({
    'access_token': '',  # leave this empty
    'expires_in': -1,  # seconds until expiry, so we force refresh anyway
    'refresh_token': refresh_token
})
try:
    op = esiapp.op['get_characters_character_id_skills'](
        character_id = c_id
    )
    return "PASS"
except:
    return "Refresh Token Invalid."

Assuming this is raising an exception, could you include what the response body is? That would include the actual error and tell you what failed.

esipy.exceptions.APIException: HTTP Error 400: b’{“error”:“invalid_grant”,“error_description”:“Invalid refresh token. Token missing/expired.”}’

Unfortunately, I do not know English well, and programming is even worse. But it seems that this is exactly why 40 scientific accounts, which I logged into once a month, do not work for me now. The support didn’t help me in any way. I contacted two times and both times I was offered, when clearing the cache did not help, re-enter 40 pairs of username and password. Tell me, can I do something in order not to spend 2 days of my life on this once a month?

Do you get that same error if you try to refresh it manually, such as via Postman or curl? E.g. following the steps within Refreshing tokens | esi-docs.

I brought this up in slack as well.

Having trouble getting this to work.

curl -XPOST -H “Content-Type:application/x-www-form-urlencoded” -H “Authorization:Basic base64(client:secret)” -d ‘{“grant_type”:“refresh_token”, “refresh_token”: “db refresh token”}’ https://login.eveonline.com/oauth/token

returns nothing. Not sure what I’m doing wrong.

edit: managed to get unknown grant_type. hopefully I’ll get there.
edit #2: application/json returns The refresh token is malformed.

You’re passing JSON data, when it should be form data.

From what was said on Slack, it seems that refresh tokens DO expire if they’re not used within a month. This should probably be added to the ESI docs.

As for @Raes_Ongrard, sounds like the solution is to at least start up those characters twice a month.

1 Like

That makes sense, thanks. Atleast I know I’m not going crazy. :slight_smile: