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

JTI Support #104

Closed
tylerFowler opened this issue Jul 7, 2015 · 7 comments
Closed

JTI Support #104

tylerFowler opened this issue Jul 7, 2015 · 7 comments

Comments

@tylerFowler
Copy link

I'd like to see the JTI (JWT ID) claim implemented so that I could, say, keep track of 'active' tokens out in the wild. And like the spec says it could be used to help prevent any replay attacks.

Are there any plans for this?

@omsmith
Copy link

omsmith commented Jul 7, 2015

You can add any claim you like in the payload. Is there something more you would want than that?

@tylerFowler
Copy link
Author

I meant native support within the library. I can do it myself (and likely will for this project), I was just wondering if there were plans to have it in the library itself for ID generation.

@kareha
Copy link

kareha commented Jul 31, 2015

Would like to see this too. Would like to set this in options.
Otherwise I would set everything in payload. Makes the options thing obsolete.
http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html#rfc.section.4.1.7

@junosuarez
Copy link
Contributor

-1. the JWT spec intentionally only describes JTI by characteristics and not a specific identifier algorithm or format. I don't think a JWT library should make that decision for you. It might make more sense to expose it as a hook to provide an ID generator function, but in JavaScript there's not much benefit to adding api surface vs just specifying the claim via an object literal.

@jwahyoung
Copy link

@jden Although I agree with what you're saying, I do think it would be nice to expose jti as a property in the options object. Currently, to add a JTI, one must assign it as a property on their payload object - and while that works, it doesn't really fit with the rest of the claims interface. I think it could be more streamlined.

I'd like to do the following:

var token = jwt.sign(user, process.env.JWT_PRIVATE, {
    algorithm: 'RS256',
    issuer: 'example.com',
    expiresInMinutes: 60,
    identifier: uuid.v4()
});

What does everyone think?

@jaredpetersen
Copy link

@jedd-ahyoung I agree with your suggestion and I would really like to see this implemented.

@jfromaniello
Copy link
Member

You can use payload.jti or options.jwtid now.

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

7 participants