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 Extra Key/Value Pairs in the Header #364

Closed
paddonizio opened this issue Jan 16, 2024 · 5 comments
Closed

Support Extra Key/Value Pairs in the Header #364

paddonizio opened this issue Jan 16, 2024 · 5 comments

Comments

@paddonizio
Copy link

Hello,

I was working on using jsonwebtoken to create the JWTs required for Coinbase authentication. Coinbase requires a nonce to be present in the header of the JWT, rather than the body. This seems a bit non-standard, but there is no way with either this library or jwt-simple that I have found to get the nonce into the header, though if I'm wrong, feel free to correct me. My proposal would be to add an additional header field, custom, that serde flattens. This would allow users to specify arbitrary additional metadata to the header that could be serialized.

If this seems reasonable and I'm not missing anything, I'm happy to put up the PR to do this. Just let me know.

Thanks!

@paddonizio
Copy link
Author

Actually even as I type this, I think that would be a breaking change to add, as it would change Headers to require a generic type. I'm still happy to add it if it makes sense, but I can also just use a custom version of this library if you want to avoid a major version bump.

@Keats
Copy link
Owner

Keats commented Jan 16, 2024

nonce is actually going to be added in #359 for the header

@paddonizio
Copy link
Author

That's great news. I'll go ahead and close this then. Thanks again.

@ryanorendorff
Copy link

@theadd336 Since that specific PR handling the header hasn't merged yet, may I ask how you got around not having nonce in the header support? If you happen to have a code snippet to run from for generating a token I'd be incredibly grateful.

@paddonizio
Copy link
Author

@ryanorendorff,

Unfortunately, I don't think my answer will be that helpful. I think I just locally cloned this branch and built against my local version of jsonwebtoken directly with this change. Since I was just experimenting and my code wasn't for production, it was the fastest way to get the nonce support I needed.

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

No branches or pull requests

3 participants