# How to check access\_token is expired?

**URL:** <https://community.auth0.com/t/how-to-check-access-token-is-expired/78890>\
**Category:** Get Help\
**Created:** [February 24, 2022, 8:40pm UTC](https://community.auth0.com/t/how-to-check-access-token-is-expired/78890 "2022-02-24T20:40:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sajan](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sajan/32/33507_2.png) [@sajan](https://community.auth0.com/u/sajan)\
**Post date:** [February 24, 2022, 8:40pm UTC](https://community.auth0.com/t/how-to-check-access-token-is-expired/78890/1 "2022-02-24T20:40:11Z")

</div>

what is best way to check access\_token is expired using JavaScript ?

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [February 24, 2022, 11:14pm UTC](https://community.auth0.com/t/how-to-check-access-token-is-expired/78890/3 "2022-02-24T23:14:14Z")

</div>

Hey there @sajan welcome to the community!

Each access token will have an `exp` (expiration) claim which is a Unix timestamp, here’s a [sample access token](https://auth0.com/docs/secure/tokens/access-tokens#sample-access-token).

You’ll most likely want to use a library listed [here](https://jwt.io/libraries) to decode an access token in order to inspect the `exp` claim.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![sajan](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sajan/32/33507_2.png) [@sajan](https://community.auth0.com/u/sajan)\
**Post date:** [February 25, 2022, 1:22am UTC](https://community.auth0.com/t/how-to-check-access-token-is-expired/78890/4 "2022-02-25T01:22:08Z")

</div>

thanks for your response. which property need to consider as token expire value **access\_token.exp** or **expires\_in**?

```auto
{
  "iss": "https://my-domain.auth0.com/",
  "sub": "auth0|123456",
  "aud": [
    "https://example.com/health-api",
    "https://my-domain.auth0.com/userinfo"
  ],
  "azp": "my_client_id",
  "exp": 1311281970,
  "iat": 1311280970,
  "scope": "openid profile read:patients read:admin"
}

```

```auto
{
    "access_token": "",
    "scope": "",
    "expires_in": 9600,
    "token_type": "Bearer"
}

```

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [February 25, 2022, 6:39pm UTC](https://community.auth0.com/t/how-to-check-access-token-is-expired/78890/5 "2022-02-25T18:39:31Z")

</div>

No problem, happy to help!

It really depends on what you’re looking for - `exp` is the timestamp for the expiration date where as `expires_in` is the number of seconds to expiration.

---

<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:** [March 12, 2022, 6:40pm UTC](https://community.auth0.com/t/how-to-check-access-token-is-expired/78890/6 "2022-03-12T18:40:24Z")

</div>

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