mirror of
https://github.com/PerpetualSoftware/pad.git
synced 2026-09-21 01:53:33 +00:00
7ca0463e70
Replace the email/password terminal prompt in `pad auth login` with a
browser-based auth flow. The CLI creates a pending session, prints a URL
the user opens in their browser (works for localhost, remote VPS, or
Pad Cloud), and polls until the session is approved.
- Add CLI auth session endpoints (create, poll, approve)
- Add browser approval page at /auth/cli/{code}
- Rewrite `pad auth login` to use browser flow by default
- Keep `pad auth login --interactive` as email/password fallback
- Add login page redirect param support for post-login bounce-back
- Add SQLite and PostgreSQL migrations for cli_auth_sessions table
Closes PLAN-539, IDEA-404
14 lines
642 B
SQL
14 lines
642 B
SQL
-- CLI auth sessions: browser-based CLI login flow.
|
|
-- The CLI creates a pending session, the user approves it in the browser,
|
|
-- and the CLI polls until a token is available.
|
|
CREATE TABLE IF NOT EXISTS cli_auth_sessions (
|
|
code TEXT PRIMARY KEY,
|
|
status TEXT NOT NULL DEFAULT 'pending', -- pending, approved, expired
|
|
token TEXT, -- session token, set on approval
|
|
user_id TEXT, -- set on approval
|
|
created_at TEXT NOT NULL,
|
|
expires_at TEXT NOT NULL
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_cli_auth_sessions_expires ON cli_auth_sessions(expires_at);
|