# Detect stale access token at the API end

**URL:** <https://community.auth0.com/t/detect-stale-access-token-at-the-api-end/94363>\
**Category:** Get Help\
**Tags:** rotating-refresh-tokens, sessions\
**Created:** [November 14, 2022, 7:23am UTC](https://community.auth0.com/t/detect-stale-access-token-at-the-api-end/94363 "2022-11-14T07:23:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ritiwari369](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ritiwari369/32/36504_2.png) [@ritiwari369](https://community.auth0.com/u/ritiwari369)\
**Post date:** [November 14, 2022, 7:23am UTC](https://community.auth0.com/t/detect-stale-access-token-at-the-api-end/94363/1 "2022-11-14T07:23:45Z")

</div>

Hi

Even after logout at REACT client end (logout() from auth0), my node server is still accepting Access tokens (I’m checking token expiry and verfying sign):-

```auto
if (decodedJwt.payload.exp < currentTime || decodedJwt.payload.iat > currentTime) return 403;
 

```

```auto
jwt.verify(jwtoken, signingKey, {'algorithms': decodedJwt.header.alg}, (error) => { return 403; }

```

So how can I detect that token in request is stale or flushed/blocked by auth0?

Thanks

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [November 28, 2022, 5:35pm UTC](https://community.auth0.com/t/detect-stale-access-token-at-the-api-end/94363/3 "2022-11-28T17:35:41Z")

</div>

Hi @ritiwari369,

In the context of Auth0, JWT access tokens are stateless and aren’t “revoked” when a user logs out. If a token is not expired and has the correct claims, it is valid.

For this scenario, I would recommend using short-lived tokens that expire more quickly. [Access Tokens](https://auth0.com/docs/secure/tokens/access-tokens)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [December 12, 2022, 5:36pm UTC](https://community.auth0.com/t/detect-stale-access-token-at-the-api-end/94363/4 "2022-12-12T17:36:36Z")

</div>

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