Skip to content

feat: capture user email on GitHub sign-in#70

Open
DealPatrol wants to merge 3 commits into
mainfrom
feat/capture-github-emails
Open

feat: capture user email on GitHub sign-in#70
DealPatrol wants to merge 3 commits into
mainfrom
feat/capture-github-emails

Conversation

@DealPatrol

Copy link
Copy Markdown
Owner

What this does

Every time someone signs into RepoFuse with GitHub, we now capture their primary verified email address and store it in the database. This builds your marketing email list automatically — no forms, no friction.

Changes

app/api/auth/github/login/route.ts

  • Added user:email to the OAuth scope (was read:user repo, now read:user user:email repo)
  • Users who have already signed in will be prompted to re-authorize once with the new scope

app/api/auth/github/callback/route.ts

  • Added fetchPrimaryEmail() — hits GET /user/emails to get the user's primary verified email
  • Fetches user profile + email in parallel (no extra latency)
  • Saves email to user_auth.email on every sign-in (UPSERT keeps it up to date)
  • Uses COALESCE so an existing email is never overwritten with null

migrations/009_add_email_to_user_auth.sql

  • Adds email TEXT column to user_auth
  • Adds index on email for fast lookups
  • Run this migration before deploying

How to deploy

  1. Run the migration on your database:
    -- migrations/009_add_email_to_user_auth.sql
    ALTER TABLE user_auth ADD COLUMN IF NOT EXISTS email TEXT;
    CREATE INDEX IF NOT EXISTS idx_user_auth_email ON user_auth (email) WHERE email IS NOT NULL;
  2. Deploy the updated code
  3. Every new sign-in will now populate user_auth.email

@vercel

vercel Bot commented May 31, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
repo-app-architect Ready Ready Preview, Comment May 31, 2026 7:08am
repofuse Ready Ready Preview, Comment, Open in v0 May 31, 2026 7:08am
v0-repo-app-architect Ready Ready Preview, Comment, Open in v0 May 31, 2026 7:08am

@supabase

supabase Bot commented May 31, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project bpjftwoiosftvjvxpovz because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

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