Skip to content

Log why provider sign-ins are rejected - #227

Merged
tnkuehne merged 1 commit into
mainfrom
social-sign-in-rejection-log
Nov 19, 2026
Merged

tnkuehne merged 1 commit into
mainfrom
social-sign-in-rejection-log

Conversation

@tnkuehne

@tnkuehne tnkuehne commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Why

A rejected Google or Microsoft sign-in redirects with only an error code such as email_verification_required. Neither the logs nor the database show which check failed, so a failing sign-in cannot be traced to a missing provider proof, an unverified local user or a missing session.

What

validateSocialUser now logs one warning per rejection through the Better Auth logger:

  • provider, validation action (create-user, link-account, …) and error code
  • local user state: none, not_found, verified or unverified
  • the email proof the provider mapping derived
  • the raw email_verified claim (true, false, missing or invalid) and whether a hosted-domain claim was present
  • for linking, whether a session was missing or did not qualify

The entry contains no email addresses or domains. Sign-in behavior is unchanged.

Verification

  • tests/social-sign-in.test.ts (32 tests) passes, including new assertions for a rejected Google sign-up and an unverified local user. One test checks that the log contains no address.
  • Lint, format and control-plane typecheck pass locally.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no actionable issues were found.

Summary

Adds warning logs that explain rejected Google and Microsoft sign-ins without recording email addresses or domains. Sign-in checks and returned error codes stay unchanged.

  • Rejected provider sign-ins now leave a warning with safe diagnostic details.

No actionable issues found.

Reviews (1) · Last reviewed commit: "Log why provider sign-ins are rejected" · Reviewed by Greptile

The OAuth callback only returns the error code, so a rejected Google or
Microsoft sign-in cannot be traced to the missing proof. Record the
validation action, local user state and provider email claims, without
addresses.
@tnkuehne
tnkuehne merged commit 2dcc795 into main Nov 19, 2026
15 of 16 checks passed
@tnkuehne
tnkuehne deleted the social-sign-in-rejection-log branch November 19, 2026 15:20
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