# How to find expiry time from auth0 token

**URL:** <https://community.auth0.com/t/how-to-find-expiry-time-from-auth0-token/100132>\
**Category:** Get Help\
**Tags:** user-password-management, user-management\
**Created:** [February 9, 2023, 10:16pm UTC](https://community.auth0.com/t/how-to-find-expiry-time-from-auth0-token/100132 "2023-02-09T22:16:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![amanmaheshwari905](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/amanmaheshwari905/32/44505_2.png) [@amanmaheshwari905](https://community.auth0.com/u/amanmaheshwari905)\
**Post date:** [February 9, 2023, 10:16pm UTC](https://community.auth0.com/t/how-to-find-expiry-time-from-auth0-token/100132/1 "2023-02-09T22:16:51Z")

</div>

Hey! Is there any way to find expiry time of a token? Jwt decode isn’t working. So does /user info contains expiry time? Any idea? Thank you so much! Plz help!

---

<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 9, 2023, 10:32pm UTC](https://community.auth0.com/t/how-to-find-expiry-time-from-auth0-token/100132/3 "2023-02-09T22:32:22Z")

</div>

Hi there @amanmaheshwari905 welcome to the community!

> [@amanmaheshwari905](#):
>
> Jwt decode isn’t working. So does /user info contains expiry time? Any idea?

Are you interested in the expiry of the ID token, access token or both? `/userinfo` won’t contain the `exp` claim of the token itself as it’s only concern is user profile data. You’ll need to get these claims from the token(s) themselves.

---

<div class="post-metadata">

**Author:** ![amanmaheshwari905](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/amanmaheshwari905/32/44505_2.png) [@amanmaheshwari905](https://community.auth0.com/u/amanmaheshwari905)\
**Post date:** [February 10, 2023, 3:41am UTC](https://community.auth0.com/t/how-to-find-expiry-time-from-auth0-token/100132/4 "2023-02-10T03:41:25Z")

</div>

Thanks for the reply! Actually I was talking about access token since I have an api that would validate this token. Now to speed up process, I was trying to store this token and it’s expiry in my cache table so that I don’t have to authenticate again and again with auth0. That is why I was searching for the way to find expiry time of access token  
@ty.frith

---

<div class="post-metadata">

**Author:** ![amanmaheshwari905](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/amanmaheshwari905/32/44505_2.png) [@amanmaheshwari905](https://community.auth0.com/u/amanmaheshwari905)\
**Post date:** [February 10, 2023, 4:05am UTC](https://community.auth0.com/t/how-to-find-expiry-time-from-auth0-token/100132/5 "2023-02-10T04:05:23Z")

</div>

Also when I get the token using email and password, what sort of token do I get? Id or access?

---

<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 11, 2023, 12:25am UTC](https://community.auth0.com/t/how-to-find-expiry-time-from-auth0-token/100132/6 "2023-02-11T00:25:41Z")

</div>

Hey @amanmaheshwari905 thanks for getting back to me 🙂

> [@amanmaheshwari905](#):
>
> Actually I was talking about access token since I have an api that would validate this token.

Gotcha! You’ll need to decode the access token to get the `exp` claim, so I would focus there. Are there any particular errors you when attempting to decode? Issues arise most often when attempting to decode an [opaque access token](https://auth0.com/docs/secure/tokens/access-tokens#opaque-access-tokens) - In order for the access token to be a JWT you’ll need to include an [audience](https://community.auth0.com/t/what-is-the-audience/71414) (API identifier in Auth0) in your authorize request.

> [@amanmaheshwari905](#):
>
> Also when I get the token using email and password, what sort of token do I get? Id or access?

If you include the `openid` scope in the request you will get both an access and ID token - Otherwise only an access token.

Hope this helps!

---

<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 9, 2023, 12:27am UTC](https://community.auth0.com/t/how-to-find-expiry-time-from-auth0-token/100132/7 "2023-03-09T00:27:25Z")

</div>

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