[PR #6053] feat(oidc-provider): support private_key_jwt #14657

Open
opened 2026-04-13 09:34:05 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6053
Author: @okisdev
Created: 11/18/2025
Status: 🔄 Open

Base: nextHead: feat(oidc)/support-private_key_jwt


📝 Commits (10+)

  • 751cb48 feat(oidc): support private_key_jwt
  • 0808ead feat(oidc): support private_key_jwt
  • eaeb2b5 feat(oidc): support private_key_jwt
  • a2b67f4 feat(oidc): support private_key_jwt
  • ede4efc feat(oidc): support private_key_jwt
  • ef85c32 Merge branch 'canary' into feat(oidc)/support-private_key_jwt
  • fc6db8a Merge branch 'canary' into feat(oidc)/support-private_key_jwt
  • 7ff1036 Merge branch 'canary' into feat(oidc)/support-private_key_jwt
  • da8b5a1 feat(oidc): support private_key_jwt
  • 5537d19 feat(oidc): support private_key_jwt

📊 Changes

9 files changed (+1127 additions, -45 deletions)

View changed files

📝 docs/content/docs/plugins/oidc-provider.mdx (+162 -1)
📝 packages/better-auth/src/plugins/mcp/index.ts (+97 -18)
📝 packages/better-auth/src/plugins/mcp/mcp.test.ts (+1 -0)
📝 packages/better-auth/src/plugins/oidc-provider/index.ts (+150 -22)
📝 packages/better-auth/src/plugins/oidc-provider/oidc.test.ts (+449 -0)
📝 packages/better-auth/src/plugins/oidc-provider/schema.ts (+32 -0)
📝 packages/better-auth/src/plugins/oidc-provider/types.ts (+15 -3)
📝 packages/better-auth/src/plugins/oidc-provider/utils.ts (+220 -1)
📝 test/unit/oidc/index.spec.ts (+1 -0)

📄 Description

This PR adds private_key_jwt support to oidc provider.

This PR close #5935.


Summary by cubic

Adds private_key_jwt client authentication to the OIDC and MCP token endpoints, enabling confidential clients to use signed JWTs instead of shared secrets. Updates discovery metadata, schema, and tests; closes #5935.

  • New Features

    • Support private_key_jwt for token endpoint auth (OIDC and MCP).
    • Verify client assertions (RS256/384/512, ES256/384/512, EdDSA) with JWKS and prevent jti replay.
    • Advertise supported methods and signing algs in discovery.
    • Infer client_id from JWT when omitted; public clients still require PKCE.
  • Migration

    • Configure clients with tokenEndpointAuthMethod = "private_key_jwt" and provide JWKS via jwks or jwks_uri.
    • Clients must send client_assertion_type = jwt-bearer and a short-lived JWT with unique jti and aud set to the token endpoint.
    • No changes needed for existing client_secret_* or public (PKCE) clients.

Written for commit 5c033bf357. 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/6053 **Author:** [@okisdev](https://github.com/okisdev) **Created:** 11/18/2025 **Status:** 🔄 Open **Base:** `next` ← **Head:** `feat(oidc)/support-private_key_jwt` --- ### 📝 Commits (10+) - [`751cb48`](https://github.com/better-auth/better-auth/commit/751cb489aacf6e682dcb762f4aac07338aed8078) feat(oidc): support private_key_jwt - [`0808ead`](https://github.com/better-auth/better-auth/commit/0808ead7382447b07e1a3f6d5d5ec01ec92f80c1) feat(oidc): support private_key_jwt - [`eaeb2b5`](https://github.com/better-auth/better-auth/commit/eaeb2b53559db7b9ef0b7ba4d08fce9662b669a1) feat(oidc): support private_key_jwt - [`a2b67f4`](https://github.com/better-auth/better-auth/commit/a2b67f4858d32418753d79347ad2b3102cc7e554) feat(oidc): support private_key_jwt - [`ede4efc`](https://github.com/better-auth/better-auth/commit/ede4efc0a5a62a810fce5e7ae39f90d4fa5e14a3) feat(oidc): support private_key_jwt - [`ef85c32`](https://github.com/better-auth/better-auth/commit/ef85c32ab52ca5e7d186c0a2e36b0b4edb776b8e) Merge branch 'canary' into feat(oidc)/support-private_key_jwt - [`fc6db8a`](https://github.com/better-auth/better-auth/commit/fc6db8a5e9ce2f20d5b6a18a19b2121a534c77b6) Merge branch 'canary' into feat(oidc)/support-private_key_jwt - [`7ff1036`](https://github.com/better-auth/better-auth/commit/7ff10369747088a78f798b0197080ac2673934cf) Merge branch 'canary' into feat(oidc)/support-private_key_jwt - [`da8b5a1`](https://github.com/better-auth/better-auth/commit/da8b5a1c69e1f6dd0d8bd88620adb2116b6c76e3) feat(oidc): support private_key_jwt - [`5537d19`](https://github.com/better-auth/better-auth/commit/5537d19b417755bd5982a089341856fcfe23d651) feat(oidc): support private_key_jwt ### 📊 Changes **9 files changed** (+1127 additions, -45 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/oidc-provider.mdx` (+162 -1) 📝 `packages/better-auth/src/plugins/mcp/index.ts` (+97 -18) 📝 `packages/better-auth/src/plugins/mcp/mcp.test.ts` (+1 -0) 📝 `packages/better-auth/src/plugins/oidc-provider/index.ts` (+150 -22) 📝 `packages/better-auth/src/plugins/oidc-provider/oidc.test.ts` (+449 -0) 📝 `packages/better-auth/src/plugins/oidc-provider/schema.ts` (+32 -0) 📝 `packages/better-auth/src/plugins/oidc-provider/types.ts` (+15 -3) 📝 `packages/better-auth/src/plugins/oidc-provider/utils.ts` (+220 -1) 📝 `test/unit/oidc/index.spec.ts` (+1 -0) </details> ### 📄 Description This PR adds `private_key_jwt` support to oidc provider. This PR close #5935. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds private_key_jwt client authentication to the OIDC and MCP token endpoints, enabling confidential clients to use signed JWTs instead of shared secrets. Updates discovery metadata, schema, and tests; closes #5935. - **New Features** - Support private_key_jwt for token endpoint auth (OIDC and MCP). - Verify client assertions (RS256/384/512, ES256/384/512, EdDSA) with JWKS and prevent jti replay. - Advertise supported methods and signing algs in discovery. - Infer client_id from JWT when omitted; public clients still require PKCE. - **Migration** - Configure clients with tokenEndpointAuthMethod = "private_key_jwt" and provide JWKS via jwks or jwks_uri. - Clients must send client_assertion_type = jwt-bearer and a short-lived JWT with unique jti and aud set to the token endpoint. - No changes needed for existing client_secret_* or public (PKCE) clients. <sup>Written for commit 5c033bf3572fc6c79300b9fa1cd7e5d1cd2a5374. 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-04-13 09:34:05 -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#14657