dwyl/learn-json-web-tokens

Issue with default expiry time

Aperta

#43 aperta il 3 ago 2015

 (6 commenti) (0 reazioni) (0 assegnatari)JavaScript (267 fork)batch import
bughelp wanted

Metriche repository

Star
 (4175 stelle)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

The intention is to expire in 7 days, but the code doesn't provide a number thats 7 days ahead of now...far from it! https://github.com/dwyl/learn-json-web-tokens/blob/master/example/lib/helpers.js#L39

$ node
> var x = Math.floor(new Date().getTime()/1000) + 7*24*60*60
undefined
> new Date(x)
Sat Jan 17 1970 15:46:41 GMT+0000 (BST)
> 

I used this instead:

Date.now() + (1000 * 60 * 60 * 24 * 7)

Guida contributor