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

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

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

State: closed
Merged: No


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.

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