Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong expiration date property #5

Closed
josuemma opened this issue Jun 23, 2017 · 1 comment
Closed

Wrong expiration date property #5

josuemma opened this issue Jun 23, 2017 · 1 comment

Comments

@josuemma
Copy link

Great Tutorial, Just a quick note:

I think in the function getTokenExpirationDate the property used to get the expiration date should be token.token_expiration_date

function getTokenExpirationDate (encodedToken) {
const token = decode(encodedToken)
if (!token.token_expiration_date) { return null }

const date = new Date(0)
date.setUTCSeconds(token.token_expiration_date)

return date
}

Cheers

@unicodeveloper
Copy link
Contributor

Hello @josuemma It is not wrong.

It is actually token.exp. Try to log the value of token in your console to see all its properties. exp is the property that denotes the token expiration date.

debugger

Date in UTC is the is when the token.exp value has been converted to UTC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants