feat(auth): add OAuth login for GitHub, Google, GitLab #30

Merged
barrettruth merged 1 commit from feat/oauth-login into main 2026-03-23 03:52:11 +00:00
barrettruth commented 2026-03-23 03:50:53 +00:00

Problem

Auth is username/password only. Friends who want to use delta need manually-created credentials. Closes #28.

Solution

Add OAuth 2.0 authorization code flow for GitHub, Google, and GitLab — no external libraries. Each provider is configured via OAUTH_{PROVIDER}_CLIENT_ID and OAUTH_{PROVIDER}_CLIENT_SECRET env vars; unconfigured providers are hidden from the login page.

New accounts table links provider identities to users. passwordHash is now nullable so OAuth-only users can exist. CSRF protection via random state cookie. Username deduplication on first OAuth login. Settings page lets users link/unlink providers (with guard against removing the last auth method). 11 new tests (209 total).

## Problem Auth is username/password only. Friends who want to use delta need manually-created credentials. Closes #28. ## Solution Add OAuth 2.0 authorization code flow for GitHub, Google, and GitLab — no external libraries. Each provider is configured via `OAUTH_{PROVIDER}_CLIENT_ID` and `OAUTH_{PROVIDER}_CLIENT_SECRET` env vars; unconfigured providers are hidden from the login page. New `accounts` table links provider identities to users. `passwordHash` is now nullable so OAuth-only users can exist. CSRF protection via random state cookie. Username deduplication on first OAuth login. Settings page lets users link/unlink providers (with guard against removing the last auth method). 11 new tests (209 total).
Sign in to join this conversation.
No description provided.