[PR #6463] [MERGED] SSO-OIDC full discovery - phase 3 #14931

Closed
opened 2026-04-13 09:42:42 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6463
Author: @Paola3stefania
Created: 12/2/2025
Status: Merged
Merged: 12/8/2025
Merged by: @Bekacru

Base: feat/sso-oidc-discovery-phase-2Head: feat/sso-oidc-discovery-phase-3


📝 Commits (5)

  • 138dbf5 feat(sso): add runtime fallback discovery for legacy OIDC providers
  • e0f7c57 docs: updated
  • f83cb48 Merge branch 'feat/sso-oidc-discovery-phase-2' into feat/sso-oidc-discovery-phase-3
  • 8e2b513 Merge branch 'feat/sso-oidc-discovery-phase-2' into feat/sso-oidc-discovery-phase-3
  • d3f5188 Merge branch 'feat/sso-oidc-discovery-phase-2' into feat/sso-oidc-discovery-phase-3

📊 Changes

3 files changed (+231 additions, -27 deletions)

View changed files

📝 docs/content/docs/plugins/sso.mdx (+2 -1)
📝 packages/sso/src/oidc.test.ts (+175 -8)
📝 packages/sso/src/routes/sso.ts (+54 -18)

📄 Description

Summary by cubic

Adds full OIDC discovery to SSO provider registration and OAuth callback so endpoint fields are auto-filled and issuers are validated. This reduces manual config and fails fast on misconfigured IdPs with clear errors.

  • New Features

    • Discovery pipeline: fetches, validates, and hydrates config from {issuer}/.well-known/openid-configuration with clear error codes.
    • Registration integration: runs discovery in registerSSOProvider, merges with user-provided values (user overrides win).
    • Runtime fallback discovery: in callbackSSO, hydrates legacy providers missing token or JWKS endpoints; redirects with structured errors on failure.
    • Token auth method selection: defaults to client_secret_basic, supports client_secret_post, rejects unsupported methods with actionable errors.
    • Public API: exports discovery utilities and errors; adds runtime helper needsRuntimeDiscovery.
    • Docs: updated SSO plugin guide with minimal OIDC setup, auto-discovered fields, and error explanations.
    • Tests: extensive unit and integration coverage for discovery, validation, error mapping, and runtime fallback.
  • Migration

    • No breaking changes. If your IdP advertises only unsupported token auth methods, set oidcConfig.tokenEndpointAuthentication to client_secret_basic or client_secret_post.

Written for commit d3f5188838. 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/6463 **Author:** [@Paola3stefania](https://github.com/Paola3stefania) **Created:** 12/2/2025 **Status:** ✅ Merged **Merged:** 12/8/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `feat/sso-oidc-discovery-phase-2` ← **Head:** `feat/sso-oidc-discovery-phase-3` --- ### 📝 Commits (5) - [`138dbf5`](https://github.com/better-auth/better-auth/commit/138dbf5fb62fba272fa73dbb5b9bc388d62a8d9b) feat(sso): add runtime fallback discovery for legacy OIDC providers - [`e0f7c57`](https://github.com/better-auth/better-auth/commit/e0f7c57d9ebc292cf9dab20137de0198f6eb8d8b) docs: updated - [`f83cb48`](https://github.com/better-auth/better-auth/commit/f83cb48ef34fb62c23e68ef24b434a8afb824c35) Merge branch 'feat/sso-oidc-discovery-phase-2' into feat/sso-oidc-discovery-phase-3 - [`8e2b513`](https://github.com/better-auth/better-auth/commit/8e2b513724421142e4daccede05a83b95757fd1b) Merge branch 'feat/sso-oidc-discovery-phase-2' into feat/sso-oidc-discovery-phase-3 - [`d3f5188`](https://github.com/better-auth/better-auth/commit/d3f518883842dcd9d448867142af72a41e493a9a) Merge branch 'feat/sso-oidc-discovery-phase-2' into feat/sso-oidc-discovery-phase-3 ### 📊 Changes **3 files changed** (+231 additions, -27 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/sso.mdx` (+2 -1) 📝 `packages/sso/src/oidc.test.ts` (+175 -8) 📝 `packages/sso/src/routes/sso.ts` (+54 -18) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Adds full OIDC discovery to SSO provider registration and OAuth callback so endpoint fields are auto-filled and issuers are validated. This reduces manual config and fails fast on misconfigured IdPs with clear errors. - **New Features** - Discovery pipeline: fetches, validates, and hydrates config from {issuer}/.well-known/openid-configuration with clear error codes. - Registration integration: runs discovery in registerSSOProvider, merges with user-provided values (user overrides win). - Runtime fallback discovery: in callbackSSO, hydrates legacy providers missing token or JWKS endpoints; redirects with structured errors on failure. - Token auth method selection: defaults to client_secret_basic, supports client_secret_post, rejects unsupported methods with actionable errors. - Public API: exports discovery utilities and errors; adds runtime helper needsRuntimeDiscovery. - Docs: updated SSO plugin guide with minimal OIDC setup, auto-discovered fields, and error explanations. - Tests: extensive unit and integration coverage for discovery, validation, error mapping, and runtime fallback. - **Migration** - No breaking changes. If your IdP advertises only unsupported token auth methods, set oidcConfig.tokenEndpointAuthentication to client_secret_basic or client_secret_post. <sup>Written for commit d3f518883842dcd9d448867142af72a41e493a9a. 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:42:42 -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#14931