# React SDK get token expire\_in

**URL:** <https://community.auth0.com/t/react-sdk-get-token-expire-in/93528>\
**Category:** Get Help\
**Tags:** jwt, auth0, login\
**Created:** [November 1, 2022, 7:16pm UTC](https://community.auth0.com/t/react-sdk-get-token-expire-in/93528 "2022-11-01T19:16:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rkrishna](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rkrishna/32/15790_2.png) [@rkrishna](https://community.auth0.com/u/rkrishna)\
**Post date:** [November 1, 2022, 7:16pm UTC](https://community.auth0.com/t/react-sdk-get-token-expire-in/93528/1 "2022-11-01T19:16:57Z")

</div>

Please include the following information in your post:

- Which SDK this is regarding: React SDK
- SDK Version: 1.10.2
- Platform Version: JavaScript
- Code Snippets/Error Messages/Supporting Details/Screenshots: Added

```auto
{
  "access_token": "eyJhbGciOxxxxxxxxxxxx",
  "id_token": "eyJhbGcixxxxxxxxxx",
  "scope": "openid profile email",
  "expires_in": 86400,
  "token_type": "Bearer"
}

```

above is the response I see in Browser Developer tools Network tab when invoked `getAccessTokenSilently`.

I’m trying to get the `expires_in` and use it to re-invoke `getAccessTokenSilently` if the token is expired.

```auto
    getAccessTokenSilently().then(( token ) => {
      console.log( token );
    })

```

But `getAccessTokenSilently` is returning only the `access_token` but I want to get the `expires_in` as well.

Any workarounds are also welcome.

---

<div class="post-metadata">

**Author:** ![quang.dang](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@quang.dang](https://community.auth0.com/u/quang.dang)\
**Post date:** [March 19, 2024, 4:24am UTC](https://community.auth0.com/t/react-sdk-get-token-expire-in/93528/2 "2024-03-19T04:24:21Z")

</div>

Is there a way to get all the other properties besides the access\_token?

I would love to have an update for this quickly as it seems this question has been around since 2022 and there hasn’t been any answer.

---

<div class="post-metadata">

**Author:** ![marcelina.barycka](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marcelina.barycka/32/56162_2.png) [@marcelina.barycka](https://community.auth0.com/u/marcelina.barycka)\
**Post date:** [March 27, 2024, 10:29am UTC](https://community.auth0.com/t/react-sdk-get-token-expire-in/93528/3 "2024-03-27T10:29:35Z")

</div>

Hi @rkrishna, @quang.dang !

> [@rkrishna](#):
>
> But `getAccessTokenSilently` is returning only the `access_token` but I want to get the `expires_in` as well.

In the `access token` returned by `getAccessTokenSilently`, you can find the same information (the time when the access token expires) as the `expires_in` from the Network tab gives yo.  
You would just need to [decode the token](https://jwt.io/) to see its claims.

 ![image](https://global.discourse-cdn.com/auth0/original/3X/d/6/d6e84e9f60b6d4928d97f060186b29fcf6bb8de3.png)

The value of `expires_in` (measured in seconds) = the `exp` cliam - `iat` claim of the access token.  
The meassure of these two claims is seconds sinc Unix epoch.

To decode the access token, you can use one of the libraries listed in [JSON Web Token Libraries - jwt.io](https://jwt.io/libraries) - more tutorials are on the respective GitHub pages.

I hope this helps!

In case, more guidance is needed, [Auth0 Professional Services 39](https://auth0.com/docs/professional-services) can definitely assist in designing/implementing an architecture to suit your UX needs, aligning with security best practices.

PS: Please make sure the token is jwt (you will get this format if you provide the `audience` parameter to the authorize endpoint).

---

<div class="post-metadata">

**Author:** ![marcelina.barycka](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marcelina.barycka/32/56162_2.png) [@marcelina.barycka](https://community.auth0.com/u/marcelina.barycka)\
**Post date:** [March 29, 2024, 8:25am UTC](https://community.auth0.com/t/react-sdk-get-token-expire-in/93528/4 "2024-03-29T08:25:06Z")

</div>


