Skip to content

docs: sketch optional no-email email/password auth design#155

Draft
jgpruitt wants to merge 2 commits into
mainfrom
jgpruitt/email-password
Draft

docs: sketch optional no-email email/password auth design#155
jgpruitt wants to merge 2 commits into
mainfrom
jgpruitt/email-password

Conversation

@jgpruitt

Copy link
Copy Markdown
Collaborator

Summary

Exploratory design sketch (docs only) for adding an optional, self-host-oriented email + password login alongside the existing GitHub/Google OAuth — without sending any email. No code/behavior changes; adds EMAIL_PASSWORD_DESIGN.md at the repo root.

Motivation: self-hosters have asked for email/password instead of OAuth. This documents what it would take and the tradeoffs, before committing to an implementation.

What the doc covers

  • Guiding principle — reuse the existing "admin delivers the secret out-of-band" model that invitations/magic links already use, so no-email is consistent with the product, not a hack.
  • The two real blockers in today's code:
    • auth.accounts.provider_id CHECK constraint (in ('google','github')) vs better-auth's provider_id='credential'.
    • the EMAIL_NOT_VERIFIED session.create.before gate in betterauth.ts, which a password sign-up (email_verified=false) would trip.
  • Config — a single AUTH_EMAIL_PASSWORD flag (+ sign-up / min-length toggles) in the existing env-var style.
  • Server / DB / Web changes, and why the CLI needs no changes (auth happens in the browser during the OAuth loopback).
  • Password reset without email — options, recommending an admin/CLI reset-link mirroring invites.
  • Security, testing, a file-by-file rollout table, and 4 open decisions that need a call before building.

Open decisions (for reviewers)

  1. email_verified semantics for credential accounts (gate-trust vs set-true) — drives whether email-invite discovery works for password users.
  2. Registration policy default (open self-service vs admin-created).
  3. Password reset in v1 (none / admin-CLI-link / defer).
  4. Hosted policy (keep memory.build OAuth-only, or allow the flag everywhere).

Note

Draft — this is a design for discussion, not an implementation.

Copilot AI review requested due to automatic review settings July 13, 2026 16:19
@jgpruitt jgpruitt self-assigned this Jul 13, 2026
@jgpruitt jgpruitt added the enhancement New feature or request label Jul 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an exploratory design document describing how to support optional email+password authentication (without any automated email) for self-hosted deployments, alongside existing GitHub/Google OAuth, while keeping the CLI flow unchanged (browser-based auth during the OAuth loopback).

Changes:

  • Introduces EMAIL_PASSWORD_DESIGN.md outlining goals, blockers, and proposed server/DB/web changes.
  • Documents configuration flags, tradeoffs around email_verified, and invite/password-reset implications.
  • Provides a rollout/testing checklist and open decisions for reviewers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread EMAIL_PASSWORD_DESIGN.md
Comment on lines +353 to +354
</content>
</invoke>
Comment thread EMAIL_PASSWORD_DESIGN.md
| Config | `packages/server/start.ts` | read `AUTH_EMAIL_PASSWORD*`, pass to `createBetterAuth`; relax the "no providers" warning |
| better-auth | `packages/server/auth/betterauth.ts` | `emailAndPassword` block; `isLoginAllowed` gate helper |
| DB | `packages/database/auth/migrate/incremental/007_credential.sql`, `version.ts` | relax `provider_id` CHECK; bump schema version |
| DB test | `auth/migrate/migrate.integration.test.ts` | update drift snapshot; credential-account case |
@jgpruitt
jgpruitt requested a review from cevian July 13, 2026 16:29
Copilot AI review requested due to automatic review settings July 13, 2026 18:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.

Comment thread EMAIL_PASSWORD_DESIGN.md
Comment on lines +3 to +4
**Status:** design direction agreed on the core decisions; two sub-calls remain
(see "Open decisions"). Not yet an implementation.
Comment thread EMAIL_PASSWORD_DESIGN.md
Comment on lines +293 to +294
- Migration footgun reminder (per AGENTS.md): this is a plain `alter table`, not a
function signature change, so no `{{fn …}}` wrapper is needed.
Comment thread EMAIL_PASSWORD_DESIGN.md
Comment on lines +492 to +493
| CLI | — | none (browser-based OAuth loopback is method-agnostic; operator surface is server-side, not the `me` client) |
| Docs | `SELF_HOST.md`, `.env.sample`, `AGENTS.md` auth summary | document the flag, no-email caveats, and the operator commands |
Comment thread EMAIL_PASSWORD_DESIGN.md
Comment on lines +494 to +495
</content>
</invoke>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants