auth0-blog / vuejs2-authentication-tutorial

144 stars 73 forks source link

Wrong expiration date property #5

Closed josuemma closed 7 years ago

josuemma commented 7 years ago

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 commented 7 years ago

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.