# Short refresh token times

**URL:** <https://forums.eveonline.com/t/short-refresh-token-times/52234>\
**Category:** Third Party Developers\
**Created:** [January 20, 2018, 10:11am UTC](https://forums.eveonline.com/t/short-refresh-token-times/52234 "2018-01-20T10:11:46Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Swizzles\_Saissore](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/swizzles_saissore/32/432368_2.png) [@Swizzles\_Saissore](https://forums.eveonline.com/u/Swizzles_Saissore)\
**Post date:** [January 20, 2018, 10:11am UTC](https://forums.eveonline.com/t/short-refresh-token-times/52234/1 "2018-01-20T10:11:46Z")

</div>

I’m currently getting refresh tokens with an expires in of only 1199. According to the oAuth RFC this is in seconds, meaning this is a little under 20 minutes.

Is it intentional to need to query the CCP server and constantly refresh tokens within this short of an interval? I’d love this see this time frame extended significantly.

---

<div class="post-metadata">

**Author:** ![Mr\_Twinkie](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/mr_twinkie/32/312909_2.png) [@Mr\_Twinkie](https://forums.eveonline.com/u/Mr_Twinkie)\
**Post date:** [January 20, 2018, 3:00pm UTC](https://forums.eveonline.com/t/short-refresh-token-times/52234/2 "2018-01-20T15:00:28Z")

</div>

having long expire times kinda defeats the purpose of a refresh token?

---

<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:** [January 20, 2018, 3:22pm UTC](https://forums.eveonline.com/t/short-refresh-token-times/52234/3 "2018-01-20T15:22:20Z")

</div>

You are confusing the `access_token` with a `refresh_token`

An `access_token` is what is used to do auth’d requests with ESI, and yes the token is only valid for 20min. Once this token expires you can use a `refresh_token` in order to get a new `access_token`. `refresh_tokens` do not expire, unless the player manually revokes them on the support site.

---

<div class="post-metadata">

**Author:** ![Swizzles\_Saissore](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/swizzles_saissore/32/432368_2.png) [@Swizzles\_Saissore](https://forums.eveonline.com/u/Swizzles_Saissore)\
**Post date:** [January 21, 2018, 4:34am UTC](https://forums.eveonline.com/t/short-refresh-token-times/52234/4 "2018-01-21T04:34:42Z")

</div>

They do expire or don’t expire?

---

<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:** [January 21, 2018, 5:03am UTC](https://forums.eveonline.com/t/short-refresh-token-times/52234/5 "2018-01-21T05:03:02Z")

</div>

`access_tokens` expire after 20min.

`refresh_tokens` do not expire but can be revoked on the support site.

---

<div class="post-metadata">

**Author:** ![Swizzles\_Saissore](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/swizzles_saissore/32/432368_2.png) [@Swizzles\_Saissore](https://forums.eveonline.com/u/Swizzles_Saissore)\
**Post date:** [January 21, 2018, 5:05am UTC](https://forums.eveonline.com/t/short-refresh-token-times/52234/6 "2018-01-21T05:05:43Z")

</div>

Thanks, that makes it slightly easier to grasp.

Still doing that query every 20 mins though, but at least we aren’t annoying the user so much.

---

<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:** [January 21, 2018, 4:56pm UTC](https://forums.eveonline.com/t/short-refresh-token-times/52234/7 "2018-01-21T16:56:20Z")

</div>

Yes that is how you would do it, use the refresh\_token to get a new access\_token as needed. Otherwise the user would have to login every 20min.

---

<div class="post-metadata">

**Author:** ![Brock\_Khans](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/brock_khans/32/409174_2.png) [@Brock\_Khans](https://forums.eveonline.com/u/Brock_Khans)\
**Post date:** [January 21, 2018, 5:17pm UTC](https://forums.eveonline.com/t/short-refresh-token-times/52234/8 "2018-01-21T17:17:12Z")

</div>

In my opinion you only refresh when you need to, not just on a flat every 20 minute schedule. I store the expires time in epoch for each token which is tied to the specific character. When a request needs to be made I check if expires time is less than current time, and if so do a quick call to get a new access token.

Be prepared to catch 4xx errors, when a user revokes the token on the CCP side, your site will get an expired error with a 4xx code. I find it good practice to allow the “delete” option where you clear them from your DB, Cache and do the call to the revoke endpoint that removes the access for your site. That way, your site knows about the revoke, and you can remove them from your end.

Also 5xx code can be present when ESI is having issues.

---

<div class="post-metadata">

**Author:** ![Swizzles\_Saissore](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/swizzles_saissore/32/432368_2.png) [@Swizzles\_Saissore](https://forums.eveonline.com/u/Swizzles_Saissore)\
**Post date:** [January 25, 2018, 4:01am UTC](https://forums.eveonline.com/t/short-refresh-token-times/52234/9 "2018-01-25T04:01:20Z")

</div>

Some good advice, thanks.

---

<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:** [April 25, 2018, 4:02am UTC](https://forums.eveonline.com/t/short-refresh-token-times/52234/10 "2018-04-25T04:02:03Z")

</div>

Closed on April 25, 2018, 4:02am UTC

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