Setting 'kid' claim as part of encode_key_loader
ramspeedy opened this issue · 1 comments
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?
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.