[PR #8550] [CLOSED] fix(oauth-provider): advertise "none" auth method in metadata when public clients exist #24955

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8550
Author: @luchersou
Created: 3/11/2026
Status: Closed

Base: canaryHead: fix/oauth-metadata-advertise-none-auth-method-v2


📝 Commits (1)

  • c9b5eaa fix(oauth-provider): advertise none auth method in metadata when public clients exist

📊 Changes

3 files changed (+51 additions, -16 deletions)

View changed files

📝 packages/oauth-provider/src/metadata.test.ts (+26 -0)
📝 packages/oauth-provider/src/metadata.ts (+2 -1)
📝 packages/oauth-provider/src/oauth.ts (+23 -15)

📄 Description

Summary

Fixes #8423

When a public OAuth client is registered with tokenEndpointAuthMethod: "none",
the discovery metadata (/.well-known/oauth-authorization-server) was not
advertising "none" in token_endpoint_auth_methods_supported.

Root Cause

getOAuthServerConfig was passing public_client_supported based solely on
opts.allowUnauthenticatedClientRegistration, ignoring clients already registered
in the database with tokenEndpointAuthMethod: "none".

Changes

  • oauth.ts: Query the database for public clients before building metadata.
    hasPublicClients is computed once and passed to both the OIDC and non-OIDC branches.
  • metadata.ts: Added optional overrides parameter to oidcServerMetadata
    to accept public_client_supported from the caller.
  • metadata.test.ts: Added two tests covering the presence and absence of
    "none" in token_endpoint_auth_methods_supported.

Summary by cubic

Fixes OAuth discovery metadata to advertise "none" in token_endpoint_auth_methods_supported when public clients exist. Ensures public clients can reliably detect support via the well-known endpoint.

  • Bug Fixes
    • Query existing public clients (tokenEndpointAuthMethod: "none") and compute a single hasPublicClients flag.
    • Pass hasPublicClients into both OIDC and non-OIDC metadata; added an optional overrides param to oidcServerMetadata.
    • Added tests for presence/absence of "none" in token_endpoint_auth_methods_supported.

Written for commit c9b5eaac49. 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/8550 **Author:** [@luchersou](https://github.com/luchersou) **Created:** 3/11/2026 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `fix/oauth-metadata-advertise-none-auth-method-v2` --- ### 📝 Commits (1) - [`c9b5eaa`](https://github.com/better-auth/better-auth/commit/c9b5eaac4960a99f7a7b84f35c9c6a0e1653bcf1) fix(oauth-provider): advertise none auth method in metadata when public clients exist ### 📊 Changes **3 files changed** (+51 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `packages/oauth-provider/src/metadata.test.ts` (+26 -0) 📝 `packages/oauth-provider/src/metadata.ts` (+2 -1) 📝 `packages/oauth-provider/src/oauth.ts` (+23 -15) </details> ### 📄 Description ## Summary Fixes #8423 When a public OAuth client is registered with `tokenEndpointAuthMethod: "none"`, the discovery metadata (`/.well-known/oauth-authorization-server`) was not advertising `"none"` in `token_endpoint_auth_methods_supported`. ## Root Cause `getOAuthServerConfig` was passing `public_client_supported` based solely on `opts.allowUnauthenticatedClientRegistration`, ignoring clients already registered in the database with `tokenEndpointAuthMethod: "none"`. ## Changes - **`oauth.ts`**: Query the database for public clients before building metadata. `hasPublicClients` is computed once and passed to both the OIDC and non-OIDC branches. - **`metadata.ts`**: Added optional `overrides` parameter to `oidcServerMetadata` to accept `public_client_supported` from the caller. - **`metadata.test.ts`**: Added two tests covering the presence and absence of `"none"` in `token_endpoint_auth_methods_supported`. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes OAuth discovery metadata to advertise "none" in token_endpoint_auth_methods_supported when public clients exist. Ensures public clients can reliably detect support via the well-known endpoint. - **Bug Fixes** - Query existing public clients (`tokenEndpointAuthMethod: "none"`) and compute a single hasPublicClients flag. - Pass hasPublicClients into both OIDC and non-OIDC metadata; added an optional overrides param to `oidcServerMetadata`. - Added tests for presence/absence of "none" in token_endpoint_auth_methods_supported. <sup>Written for commit c9b5eaac4960a99f7a7b84f35c9c6a0e1653bcf1. 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:39:13 -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#24955