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

ignoreExpiration - differences between auth-jwt2 and node-jsonwebtoken #210

Open
cjnqt opened this issue Nov 17, 2016 · 2 comments
Open

Comments

@cjnqt
Copy link

cjnqt commented Nov 17, 2016

A possibly important bug in the documentation:

The option ignoreExpiration is described here as ignoreExpiration - ignore expired tokens.

But this is implemented by node-jsonwebtoken which describes that options as
ignoreExpiration - if true do not validate the expiration of the token.

Doesn't these descriptions mean different things?

@nelsonic
Copy link
Member

@cjnqt great question! (thanks for opening the issue to help us clarify this...!)

we need to check this in our tests... https://github.com/dwyl/hapi-auth-jwt2/tree/c2fe39237e1f1c6dc2ae2d6aae38e00dc343ded7/test

@cjnqt
Copy link
Author

cjnqt commented Nov 18, 2016

This is related: https://github.com/auth0/node-jsonwebtoken/blob/cc0f4d67b649110a035db3df9265f05db269a15a/test/jwt.hs.tests.js#L71

it('should NOT return an error when the token is expired with "ignoreExpiration"', function(done) {
      var token = jwt.sign({ exp: 1, foo: 'bar' }, secret, { algorithm: 'HS256' });
      jwt.verify(token, secret, { algorithm: 'HS256', ignoreExpiration: true }, function(err, decoded) {
        assert.ok(decoded.foo);
        assert.equal('bar', decoded.foo);
        assert.isNull(err);
        done();
      });
    });

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

2 participants