jwtk / njwt

Node.js JWT support
Apache License 2.0
432 stars 49 forks source link

Remove jti? #68

Closed rlaferla closed 5 years ago

rlaferla commented 5 years ago

I don't want the jti. How do I remove it?

swiftone commented 5 years ago

You have a few options, but no explicit built-in support for what you're trying.

1) You can call new Jwt(claims, false) ( https://github.com/jwtk/njwt/blob/master/index.js#L140 ) to prevent the .jti from being added, but that will also remove the default addition of iat.

2) You can delete jwt.body.jti before calling .compact() on the JWT. (untested, but looks clean)

Once the JWT is signed (via compact()) you are out of options to change it.