How to find expiry time from auth0 token

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!

Hi there @amanmaheshwari905 welcome to the community!

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.

1 Like

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

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

Hey @amanmaheshwari905 thanks for getting back to me :slight_smile:

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 - In order for the access token to be a JWT you’ll need to include an audience (API identifier in Auth0) in your authorize request.

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!

1 Like

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