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

Issue with default expiry time #43

Open
alanshaw opened this issue Aug 3, 2015 · 6 comments
Open

Issue with default expiry time #43

alanshaw opened this issue Aug 3, 2015 · 6 comments

Comments

@alanshaw
Copy link
Member

alanshaw commented Aug 3, 2015

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)
@nelsonic
Copy link
Member

nelsonic commented Aug 3, 2015

@alanshaw much betterer! 👍
Do you have time to submit as PR?

@emersonmellado
Copy link
Contributor

PR out #78

@nelsonic
Copy link
Member

Gents, my reading of this SO Question/Answer:
https://stackoverflow.com/questions/28738168/how-to-create-jwt-exp-style-date-in-javascript
is that we need to divide by 1000 to convert to seconds for exp ...

@emersonmellado
Copy link
Contributor

I think we solved it from an expiration point of view by adding the '7d' option.

What I see now is that we have travis-ci not happy about that change and I'm not sure how to debug it.

@emersonmellado
Copy link
Contributor

PR #79 out for test fix. green build this time :)

https://travis-ci.org/dwyl/learn-json-web-tokens

image

@nelsonic
Copy link
Member

@emersonmellado thanks again for making time to fix this! 👍

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

No branches or pull requests

3 participants