[PR #8625] [CLOSED] fix(oidc-provider): public client registration #25003

Closed
opened 2026-04-15 22:41:12 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8625
Author: @okisdev
Created: 3/16/2026
Status: Closed

Base: mainHead: fix(oidc-provider)/public-client-registration


📝 Commits (3)

  • 857a480 fix(oidc-provider): public client registration
  • 01bac2e fix(oidc-provider): public client registration
  • 76667c1 fix(oidc-provider): address review comments for public client support

📊 Changes

3 files changed (+520 additions, -20 deletions)

View changed files

📝 packages/better-auth/src/plugins/oidc-provider/index.ts (+81 -15)
📝 packages/better-auth/src/plugins/oidc-provider/oidc.test.ts (+438 -4)
📝 test/unit/oidc/scope-consent.spec.ts (+1 -1)

📄 Description

fixes three issues preventing MCP/public clients (token_endpoint_auth_method: "none") from completing OAuth:

  • hardcoded type: "web" → now "public" when auth method is "none"
  • || treats "none" as falsy → replaced with ??
  • definePayload override loses JWT plugin claims → now merges with base payload, adds scope

Summary by cubic

Enables full OIDC dynamic registration and token flows for public clients. Supports token_endpoint_auth_method: "none", requires ID token signing via the jwt plugin when openid is requested, and enforces client auth on refresh tokens.

  • Bug Fixes
    • Public registration: set type "public" when auth method is "none", preserve "none" via ??, skip generating/storing client_secret, and omit secret fields (incl. client_secret_expires_at) in responses. OpenAPI: type enum adds "public", authenticationScheme enum lists "client_secret_basic" | "client_secret_post" | "none", clientSecret is nullable and not required.
    • ID token: merge the jwt plugin’s base payload in definePayload, add scope. Require the jwt plugin for public clients only when openid is requested; reject HS256 for them. Allow access-token-only exchanges without the jwt plugin when no openid scope.
    • Refresh tokens: validate client and reject disabled/unknown. Confidential clients must present a valid client_secret (verified against stored secret).

Written for commit 76667c18e0. Summary will update 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/8625 **Author:** [@okisdev](https://github.com/okisdev) **Created:** 3/16/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix(oidc-provider)/public-client-registration` --- ### 📝 Commits (3) - [`857a480`](https://github.com/better-auth/better-auth/commit/857a4801cc36780a6ae68147762eefb973a52043) fix(oidc-provider): public client registration - [`01bac2e`](https://github.com/better-auth/better-auth/commit/01bac2e8eedb069f7064cec2ee152e84843c2440) fix(oidc-provider): public client registration - [`76667c1`](https://github.com/better-auth/better-auth/commit/76667c18e0108a96c333a7f7141db7d674c787c4) fix(oidc-provider): address review comments for public client support ### 📊 Changes **3 files changed** (+520 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/oidc-provider/index.ts` (+81 -15) 📝 `packages/better-auth/src/plugins/oidc-provider/oidc.test.ts` (+438 -4) 📝 `test/unit/oidc/scope-consent.spec.ts` (+1 -1) </details> ### 📄 Description fixes three issues preventing MCP/public clients (`token_endpoint_auth_method: "none"`) from completing OAuth: - hardcoded `type: "web"` → now `"public"` when auth method is `"none"` - `||` treats `"none"` as falsy → replaced with `??` - `definePayload` override loses JWT plugin claims → now merges with base payload, adds `scope` <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Enables full OIDC dynamic registration and token flows for public clients. Supports `token_endpoint_auth_method: "none"`, requires ID token signing via the `jwt` plugin when `openid` is requested, and enforces client auth on refresh tokens. - **Bug Fixes** - Public registration: set type "public" when auth method is "none", preserve "none" via `??`, skip generating/storing `client_secret`, and omit secret fields (incl. `client_secret_expires_at`) in responses. OpenAPI: `type` enum adds "public", `authenticationScheme` enum lists "client_secret_basic" | "client_secret_post" | "none", `clientSecret` is nullable and not required. - ID token: merge the `jwt` plugin’s base payload in `definePayload`, add `scope`. Require the `jwt` plugin for public clients only when `openid` is requested; reject HS256 for them. Allow access-token-only exchanges without the `jwt` plugin when no `openid` scope. - Refresh tokens: validate client and reject disabled/unknown. Confidential clients must present a valid `client_secret` (verified against stored secret). <sup>Written for commit 76667c18e0108a96c333a7f7141db7d674c787c4. Summary will update 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-15 22:41:12 -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#25003