feat(auth): social sign-in server core — Supabase + wallet account-linking (part 1)#152
Merged
Conversation
…ount-linking
Adds Google/Apple/passkey sign-in (via Supabase Auth) alongside wallet SIWS,
keeping the wallet as the authorization principal via account-linking.
- Migration auth_identity_links (supabase_user_id ↔ wallet).
- supabaseUser.js: verify a Supabase access token via supabase.auth.getUser
(no local JWT secret needed); x-supabase-token header.
- identity-link repo + service (optionally mirrors email into wallet_contacts).
- auth.controller + /api/auth routes:
- POST /link-wallet: requires a valid Supabase session AND a SIWS signature,
records the link, returns the existing HMAC session bearer for the wallet.
- POST /session-from-social: Supabase session → linked wallet → session bearer
(409 needsLink if not linked). Reuses issueSessionToken so ALL existing
route middleware authorize unchanged.
- CORS allows x-supabase-token. 7 new tests; full suite green (271).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
4 tasks
sacha-l
added a commit
that referenced
this pull request
May 22, 2026
…k-bridge chore(auth): remove unused social account-linking bridge (#152)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Server foundation for Google / Apple / passkey sign-in (via Supabase Auth) alongside the existing wallet (SIWS) auth. The wallet stays the authorization principal via account-linking, so the entire admin/builder authz layer is unchanged.
This is part 1 (server). The client UI is the next slice on this branch (see "Next").
How it works
requireAdmin/requireProgramAdmin/ team checks all authorize unchanged.supabase.auth.getUser(token)(no local JWT secret).Server changes
auth_identity_links(supabase_user_id↔ wallet).auth/supabaseUser.js— verify a Supabase access token (x-supabase-tokenheader).identity-linkrepository + service (best-effort mirror of email intowallet_contacts).auth.controller+/api/authroutes:POST /api/auth/link-wallet— requires a valid Supabase session and a SIWS signature; records the link; returns a wallet-scoped session bearer.POST /api/auth/session-from-social— Supabase session → linked wallet → session bearer (409 needsLinkif not linked yet).x-supabase-token.Test plan
node --check server.js— OK.npm test(server) — 271 passed (7 new auth-controller tests: invalid session, missing/failed SIWS, successful link, needs-link, session issue).VITE_SUPABASE_URL+VITE_SUPABASE_ANON_KEY(Vercel). Server already hasSUPABASE_URL.Next (client, this branch)
@supabase/supabase-jsclient + Google/Apple/passkey buttons + the OAuth-return →session-from-social→ (first time) connect-walletlink-walletflow, wired into the admin sign-in. Best built against the configured providers so it's testable end-to-end.Per CLAUDE.md §6: draft, never merging.