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

Support to add additional JWT headers #12

Merged
merged 2 commits into from
Jan 19, 2017

Conversation

callmepjs
Copy link
Contributor

Creating pull request to add support for adding additional JWT headers to the JWT token.

New headers can be specified in the header property of the payload. For example, to specify a key id (kid) used to sign the JWT token:

   var jwt = require('json-web-token');
   var payload = { iss: 'my_issurer', iat: 1400062400223, header: {"kid": "myKeyId"} };
   jwt.encode(key, payload, 'RS256');

Decoded Header:

  {
     "typ": "JWT",
     "alg": "RS256",
     "kid": "myKeyId"
  }

Decoded Payload:

  {
     "iss": "my_issurer",
     "iat": 1400062400223
  }

@joaquimserafim
Copy link
Owner

Hi @callmepjs can you add a test for this case please, Thanks

@callmepjs
Copy link
Contributor Author

Hi @joaquimserafim , added unit test cases for verifying encoding and decoding.

@joaquimserafim joaquimserafim merged commit 1210ff3 into joaquimserafim:master Jan 19, 2017
@callmepjs
Copy link
Contributor Author

Thanks. Could you please make a new release with this patch ?

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

Successfully merging this pull request may close these issues.

2 participants