Skip to content

fix(sso): mark email verified on sign-in through a verified-domain provider - #9586

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/sso-verified-domain-email-verified
Nov 2, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
fix/sso-verified-domain-email-verified

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • SSO keeps trustEmailVerified: false, so Better Auth stores every SSO-created user as unverified, and SCIM provisioning does the same. Nothing ever flipped the flag, so users who only sign in through their IdP were refused when connecting accounts ("Verify your email address before connecting an account").
  • SSO admission now marks the user verified once it has proven the same things account linking relies on: the provider's domain is DNS-verified, the account is linked to that provider, and the user's email is on that domain.
  • trustEmailVerified stays off; the IdP's email_verified claim is still never trusted.

Type of Change

  • Bug fix

Testing

  • admit-sso-user.integration.ts against real Postgres: the new directory-provisioned member case fails on the pre-fix code and passes with the fix; added guards that an off-domain address and an unverified provider domain stay unverified (7/7 pass)
  • bun run test lib/auth/sso (97 pass), biome on changed files; type-check and audits in CI

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

🤖 Generated with Claude Code

@vercel

vercel Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 2, 2026 11:51pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Marks SSO users’ email addresses verified after checking the provider’s verified domain, linked account, and matching email domain.

  • A verified-domain SSO sign-in marks the user's email as verified.

Reviews (2) · Last reviewed commit: "fix(sso): only verify the email the doma..." · Reviewed by Greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit eb6bcdb into staging Nov 2, 2026
50 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/sso-verified-domain-email-verified branch November 2, 2026 23:54

This branch was previously deployed

1 inactive deployment
Preview — 48f6aabd Deployed Nov 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant