[PR #6618] [MERGED] feat(sso): use domain verified flag to trust providers automatically #6782

Closed
opened 2026-03-13 13:11:32 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

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

Base: canaryHead: feat/oidc-saml-account-linking-consistency


📝 Commits (6)

  • caeb38f feat: unify is trusted by domain
  • 55669ba feat: add tests
  • f429263 make lint happy
  • 0f2f16d fix: remove deprecated docu
  • 6920de5 fix: rename to isTrustedProvider
  • b0f9c52 Merge branch 'canary' into feat/oidc-saml-account-linking-consistency

📊 Changes

5 files changed (+341 additions, -11 deletions)

View changed files

📝 docs/content/docs/plugins/sso.mdx (+3 -1)
📝 packages/better-auth/src/oauth2/link-account.test.ts (+161 -0)
📝 packages/better-auth/src/oauth2/link-account.ts (+7 -10)
📝 packages/sso/src/oidc.test.ts (+164 -0)
📝 packages/sso/src/routes/sso.ts (+6 -0)

📄 Description

Summary by cubic

Unifies SSO trust checks for OIDC and SAML so domain-verified providers are trusted for automatic account linking when the email domain matches. Updates docs to state that verified domains enable automatic linking.

  • New Features
    • Treat domain-verified providers as trusted for auto account linking (OIDC + SAML) when email domain matches.
    • Compute isTrustedProvider in the SSO callback using provider.domainVerified and validateEmailDomain.
    • Pass isTrustedProvider into handleOAuthUserInfo to allow linking without email_verified.
    • Add tests for OAuth2 linking (trusted vs untrusted) and OIDC domain-verified linking.

Written for commit b0f9c52d7c. 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/6618 **Author:** [@Paola3stefania](https://github.com/Paola3stefania) **Created:** 12/8/2025 **Status:** ✅ Merged **Merged:** 12/8/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `feat/oidc-saml-account-linking-consistency` --- ### 📝 Commits (6) - [`caeb38f`](https://github.com/better-auth/better-auth/commit/caeb38f529be660cfcf2aab2261bb681e2f9a475) feat: unify is trusted by domain - [`55669ba`](https://github.com/better-auth/better-auth/commit/55669bae365992de9cf89289ef69f95050dfc07c) feat: add tests - [`f429263`](https://github.com/better-auth/better-auth/commit/f4292631f1f98bf3bfd26614e345ef0502427cd3) make lint happy - [`0f2f16d`](https://github.com/better-auth/better-auth/commit/0f2f16d12041a75c8eb488ddec30db6691928940) fix: remove deprecated docu - [`6920de5`](https://github.com/better-auth/better-auth/commit/6920de53ae79aa321406c4be81d5650fe08b0d8f) fix: rename to isTrustedProvider - [`b0f9c52`](https://github.com/better-auth/better-auth/commit/b0f9c52d7c9ce38ebb13a0923bba18c8fbd52724) Merge branch 'canary' into feat/oidc-saml-account-linking-consistency ### 📊 Changes **5 files changed** (+341 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/sso.mdx` (+3 -1) 📝 `packages/better-auth/src/oauth2/link-account.test.ts` (+161 -0) 📝 `packages/better-auth/src/oauth2/link-account.ts` (+7 -10) 📝 `packages/sso/src/oidc.test.ts` (+164 -0) 📝 `packages/sso/src/routes/sso.ts` (+6 -0) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Unifies SSO trust checks for OIDC and SAML so domain-verified providers are trusted for automatic account linking when the email domain matches. Updates docs to state that verified domains enable automatic linking. - **New Features** - Treat domain-verified providers as trusted for auto account linking (OIDC + SAML) when email domain matches. - Compute isTrustedProvider in the SSO callback using provider.domainVerified and validateEmailDomain. - Pass isTrustedProvider into handleOAuthUserInfo to allow linking without email_verified. - Add tests for OAuth2 linking (trusted vs untrusted) and OIDC domain-verified linking. <sup>Written for commit b0f9c52d7c9ce38ebb13a0923bba18c8fbd52724. 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-03-13 13:11:32 -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#6782