[PR #6269] [MERGED] feat(jwt): allow custom jwks endpoint #6555

Closed
opened 2026-03-13 13:03:09 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6269
Author: @luist18
Created: 11/24/2025
Status: Merged
Merged: 11/24/2025
Merged by: @Bekacru

Base: canaryHead: feat/custom-jwks-endpoint


📝 Commits (4)

  • ef24bcd feat(jwt-plugin): allow custom jwks endpoint
  • ff9c3d7 fix lint
  • f267e63 add option to the jwt client
  • f0907ab add docs for the new option

📊 Changes

5 files changed (+134 additions, -2 deletions)

View changed files

📝 docs/content/docs/plugins/jwt.mdx (+51 -0)
📝 packages/better-auth/src/plugins/jwt/client.ts (+27 -1)
📝 packages/better-auth/src/plugins/jwt/index.ts (+14 -1)
📝 packages/better-auth/src/plugins/jwt/jwt.test.ts (+33 -0)
📝 packages/better-auth/src/plugins/jwt/types.ts (+9 -0)

📄 Description

Allows configuring a custom JWKS endpoint path in the JWT plugin via the jwks.jwksPath option (defaulting to /jwks). This enables exposing the JWKS at alternative paths such as the standard /.well-known/jwks.json while preserving backwards compatibility. A test was added to validate this behavior.


Summary by cubic

Allow configuring the JWKS endpoint path in the JWT plugin and client via jwks.jwksPath (default /jwks), with validation to reject unsafe paths. Client exposes a jwks action for the configured path; types and tests updated to support /.well-known/jwks.json and ensure /jwks returns 404 when overridden.

Written for commit f0907ab8c7. Summary will update automatically on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/6269 **Author:** [@luist18](https://github.com/luist18) **Created:** 11/24/2025 **Status:** ✅ Merged **Merged:** 11/24/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `feat/custom-jwks-endpoint` --- ### 📝 Commits (4) - [`ef24bcd`](https://github.com/better-auth/better-auth/commit/ef24bcd6d8d286d5b47093eff3999832f6985d06) feat(jwt-plugin): allow custom jwks endpoint - [`ff9c3d7`](https://github.com/better-auth/better-auth/commit/ff9c3d77caeedeef393a82b1182c5380b7e826f5) fix lint - [`f267e63`](https://github.com/better-auth/better-auth/commit/f267e63885c5e83650aaf897d23a880711cfc95c) add option to the jwt client - [`f0907ab`](https://github.com/better-auth/better-auth/commit/f0907ab8c7771ef291891eab59c13dc0b5693227) add docs for the new option ### 📊 Changes **5 files changed** (+134 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/jwt.mdx` (+51 -0) 📝 `packages/better-auth/src/plugins/jwt/client.ts` (+27 -1) 📝 `packages/better-auth/src/plugins/jwt/index.ts` (+14 -1) 📝 `packages/better-auth/src/plugins/jwt/jwt.test.ts` (+33 -0) 📝 `packages/better-auth/src/plugins/jwt/types.ts` (+9 -0) </details> ### 📄 Description Allows configuring a custom JWKS endpoint path in the JWT plugin via the `jwks.jwksPath` option (defaulting to `/jwks`). This enables exposing the JWKS at alternative paths such as the standard `/.well-known/jwks.json` while preserving backwards compatibility. A test was added to validate this behavior. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Allow configuring the JWKS endpoint path in the JWT plugin and client via jwks.jwksPath (default /jwks), with validation to reject unsafe paths. Client exposes a jwks action for the configured path; types and tests updated to support /.well-known/jwks.json and ensure /jwks returns 404 when overridden. <sup>Written for commit f0907ab8c7771ef291891eab59c13dc0b5693227. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 13:03:09 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#6555