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

Setting 'kid' claim as part of encode_key_loader #551

Open
ramspeedy opened this issue May 18, 2024 · 1 comment
Open

Setting 'kid' claim as part of encode_key_loader #551

ramspeedy opened this issue May 18, 2024 · 1 comment

Comments

@ramspeedy
Copy link

Firstly thanks for maintaining the library!

I'm using encode_key_loader to specify keys for different types of JWTs in my application. I realized that we cannot set the kid claim in encode_key_loader or conversely read the kid within encode_key_loader to determine which key to use. Was this a purposeful restriction, or are you open enabling this?

@vimalloc
Copy link
Owner

vimalloc commented Jun 6, 2024

Sorry about the delay getting back to you, this slipped through the cracks on my end.

I'm not opposed to this, but I am not entirely sure how I would go about implementing it. I think if we are going to have a way to pass all of the data in, but that's not trivial to do since (I think) some of the data is not currently present until we actually call into PyJWT to create the token. This also has the problem that it would be a breaking change, so I would need to handle that gracefully.

I think what I will suggest doing for now is using flask.g to store the kid before creating the token, and then using flask.g to pull the kid back out in your encode_key_loader callback function.

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

2 participants