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

Closed
opened 2026-04-13 10:29:59 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/better-auth/better-auth/pull/8625

State: closed
Merged: No


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.

**Original Pull Request:** https://github.com/better-auth/better-auth/pull/8625 **State:** closed **Merged:** No --- 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. -->
GiteaMirror added the pull-request label 2026-04-13 10:29:59 -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#16349