[PR #7818] [MERGED] feat(sso): add shared redirectURI option for OIDC providers #7573

Closed
opened 2026-03-13 13:41:57 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7818
Author: @Paola3stefania
Created: 2/6/2026
Status: Merged
Merged: 2/16/2026
Merged by: @Bekacru

Base: canaryHead: feat/sso-redirect-uri


📝 Commits (6)

  • 4cf3a1c feat: redirect uro sso
  • ec748f7 validation and types
  • 1497e96 Merge remote-tracking branch 'origin/canary' into feat/sso-redirect-uri
  • 42decc9 Merge branch 'canary' into feat/sso-redirect-uri
  • 8b9f055 Merge branch 'canary' into feat/sso-redirect-uri
  • 4bb784e Merge branch 'canary' into feat/sso-redirect-uri

📊 Changes

5 files changed (+713 additions, -392 deletions)

View changed files

📝 docs/content/docs/plugins/sso.mdx (+50 -0)
📝 packages/sso/src/index.ts (+3 -0)
📝 packages/sso/src/oidc.test.ts (+165 -0)
📝 packages/sso/src/routes/sso.ts (+490 -392)
📝 packages/sso/src/types.ts (+5 -0)

📄 Description

addresses https://github.com/better-auth/better-auth/issues/7693


Summary by cubic

Adds a shared redirectURI option for OIDC SSO so all providers can use a single callback URL, simplifying IdP setup and migrations. Introduces a shared callback endpoint and updates state handling while keeping per‑provider callbacks working.

  • New Features

    • New sso({ redirectURI }) to use one OIDC callback for all providers; accepts relative path or full URL.
    • New shared endpoint /sso/callback; providerId is read from OAuth state.
    • Provider registration returns the shared redirectURI when set.
    • Exposes callbackSSOShared in the plugin; docs updated and tests cover the shared flow.
  • Refactors

    • Centralized OIDC callback logic into a shared handler used by both per‑provider and shared endpoints.
    • Added getOIDCRedirectURI; signInSSO stores ssoProviderId in state and uses the shared URI when configured.
    • SAML: Buffer-based base64 decoding, safer final redirect handling, improved default name, and consistent provisionUser execution.

Written for commit 4bb784efc7. 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/7818 **Author:** [@Paola3stefania](https://github.com/Paola3stefania) **Created:** 2/6/2026 **Status:** ✅ Merged **Merged:** 2/16/2026 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `feat/sso-redirect-uri` --- ### 📝 Commits (6) - [`4cf3a1c`](https://github.com/better-auth/better-auth/commit/4cf3a1cb3ec0a41a4de439e3276de788f7018817) feat: redirect uro sso - [`ec748f7`](https://github.com/better-auth/better-auth/commit/ec748f7d6377b9a3c3cd588142e3c88055db7cf5) validation and types - [`1497e96`](https://github.com/better-auth/better-auth/commit/1497e96f55eaf33f7518825aa730bf1443434dd0) Merge remote-tracking branch 'origin/canary' into feat/sso-redirect-uri - [`42decc9`](https://github.com/better-auth/better-auth/commit/42decc9ee196f38dc0cf463d1039515f78933775) Merge branch 'canary' into feat/sso-redirect-uri - [`8b9f055`](https://github.com/better-auth/better-auth/commit/8b9f055d0994717380c92692181128ea9ca7db50) Merge branch 'canary' into feat/sso-redirect-uri - [`4bb784e`](https://github.com/better-auth/better-auth/commit/4bb784efc7928308dfd7db8b6ee639f14cf56048) Merge branch 'canary' into feat/sso-redirect-uri ### 📊 Changes **5 files changed** (+713 additions, -392 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/sso.mdx` (+50 -0) 📝 `packages/sso/src/index.ts` (+3 -0) 📝 `packages/sso/src/oidc.test.ts` (+165 -0) 📝 `packages/sso/src/routes/sso.ts` (+490 -392) 📝 `packages/sso/src/types.ts` (+5 -0) </details> ### 📄 Description addresses https://github.com/better-auth/better-auth/issues/7693 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds a shared redirectURI option for OIDC SSO so all providers can use a single callback URL, simplifying IdP setup and migrations. Introduces a shared callback endpoint and updates state handling while keeping per‑provider callbacks working. - New Features - New sso({ redirectURI }) to use one OIDC callback for all providers; accepts relative path or full URL. - New shared endpoint /sso/callback; providerId is read from OAuth state. - Provider registration returns the shared redirectURI when set. - Exposes callbackSSOShared in the plugin; docs updated and tests cover the shared flow. - Refactors - Centralized OIDC callback logic into a shared handler used by both per‑provider and shared endpoints. - Added getOIDCRedirectURI; signInSSO stores ssoProviderId in state and uses the shared URI when configured. - SAML: Buffer-based base64 decoding, safer final redirect handling, improved default name, and consistent provisionUser execution. <sup>Written for commit 4bb784efc7928308dfd7db8b6ee639f14cf56048. 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-03-13 13:41:57 -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#7573