Skip to content

Add kid to JWKs #221

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add kid to JWKs #221

wants to merge 1 commit into from

Conversation

natac13
Copy link

@natac13 natac13 commented May 30, 2025

Use 'latest' JWK's kid in the signing headers. This is used by clients to efficiently find the right JWK from the list

I noticed this was missing when trying to use hono/jwk middleware

Add kid to the JWKS and the signing headers so that clients can use it to find the JWK from the list to verify.

I choose, (maybe wrongly) that the 'latest' key it the first one in the list. Could go either way.

While trying to use the convex auth supplied access token from a Hono api with their jwk middleware, I got an error about the kid field missing.

I learned that it is to uniquely identify the JWK so the client does not have to check every key in the list from the endpoint.

I check on how Openauth does this here

I found that the Convex Backend uses the Biscuit library to decode the jwks here

However, after checking on the source for the Biscuit decode_with_jwks I am not sure how it does not throw a similar error due to the missing kid


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Use 'latest' JWK's kid in the signing headers. This is used by clients to efficiently find the right JWK from the list

I noticed this was missing when trying to use hono/jwk middleware
Copy link

vercel bot commented May 30, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
convex-auth-docs ✅ Ready (Inspect) Visit Preview May 30, 2025 11:32am

@thomasballinger
Copy link
Contributor

@natac13 great point, for OIDC https://docs.convex.dev/auth/advanced/custom-auth we don't use Biscuit, we use https://github.com/ramosbugs/openidconnect-rs. I think using a kid is a good idea. Sorry for the trouble when using this via Hono!

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

Successfully merging this pull request may close these issues.

2 participants