Skip to content

Allow OAuth user creation without email#16

Merged
slhmy merged 4 commits intomainfrom
copilot/allow-empty-email-oauth
Feb 9, 2026
Merged

Allow OAuth user creation without email#16
slhmy merged 4 commits intomainfrom
copilot/allow-empty-email-oauth

Conversation

Copy link
Contributor

Copilot AI commented Feb 8, 2026

OAuth providers may not share user email based on privacy settings. Previously, ensureOAuthUser rejected authentication attempts when email was missing.

Changes

  • Schema: Removed not null constraint from UserModel.Email field
  • MongoDB: Made email index sparse to allow multiple empty values while preserving uniqueness for non-empty emails
  • Logic: ensureOAuthUser now creates users with only provider ID when email is unavailable
// Before: returned error if email empty
if strings.TrimSpace(info.Email) == "" {
    return nil, status.Error(codes.FailedPrecondition, "email is required")
}

// After: creates user with provider ID only
userModel := &domain.UserModel{GithubID: &info.ID}

Backward compatible - existing email-based flows unchanged.

Original prompt

allow email to be empty while ensureOAuthUser

The user has attached the following file paths as relevant context:

  • .github/instructions/common.instructions.md

Created from VS Code.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits February 8, 2026 15:56
Co-authored-by: slhmy <31381093+slhmy@users.noreply.github.com>
Co-authored-by: slhmy <31381093+slhmy@users.noreply.github.com>
Co-authored-by: slhmy <31381093+slhmy@users.noreply.github.com>
Copilot AI changed the title [WIP] Allow email to be empty while ensuring OAuth user Allow OAuth user creation without email Feb 8, 2026
Copilot AI requested a review from slhmy February 8, 2026 16:00
@slhmy slhmy marked this pull request as ready for review February 9, 2026 02:28
@slhmy slhmy merged commit e061c99 into main Feb 9, 2026
1 check passed
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.

2 participants