#30 [Feature]: Add browser-based CLI login
Originally created by: thomijasir
Originally owned by: thomijasir
Feature description
Add an authorization-code login flow that lets users approve the CLI in a browser instead of entering their account password in the terminal.
Current behavior
Interactive login asks for email and password in the terminal. Automation can save a runner token through standard input.
Why we need this
Browser approval fits SSO, password-manager, and managed authentication workflows. It also keeps account passwords out of terminal input and CLI process memory.
Proposed CLI interface
dopbase login --browserdopbase login --browser --no-open
Expected behavior
- Request a short-lived, single-use authorization code from the active server.
- Print the verification URL and user code, then open the URL unless
--no-openis present. - Poll at the interval returned by the server until approval, rejection, expiry, cancellation, or timeout.
- Save the issued CLI session through the existing encrypted session store.
- Bind the authorization request to the active server and show that server before opening the browser.
- Handle Ctrl+C without leaving a usable pending code.
- Keep password login and
login --tokenavailable for compatibility. - Return a useful result in human output while keeping tokens out of all output modes.
Security and compatibility
- Codes must be short-lived, single-use, rate-limited, and safe to display.
- The browser must receive no local session token from the CLI.
- Do not place credentials in URLs, command arguments, clipboard content, or logs.
- The server must invalidate the pending request after approval, rejection, expiry, or cancellation.
Out of scope
- Removing password login.
- Changing runner-token login.
- Adding SSO providers inside the CLI.
Acceptance criteria
- [ ] A user can approve the displayed code in a browser and receive an encrypted local session.
- [ ]
--no-opensupports remote terminals by printing the URL and code. - [ ] Rejected and expired attempts return distinct errors.
- [ ] Cancellation stops polling and invalidates the pending request when possible.
- [ ] A code cannot be exchanged twice or from another server.
- [ ] No token appears in stdout, stderr, process arguments, or debug logs.
Test scenarios
- Add CLI polling tests under
app/tests/cli/and server tests for the authorization lifecycle. - Cover approval, rejection, expiry, rate limits, slow-down responses, cancellation, browser-open failure, no-open mode, server switching, encrypted storage, and redaction.
Documentation
Document browser login, remote terminal use, expiry, cancellation, existing login alternatives, and troubleshooting.
Dependencies
Blocked on server endpoints for authorization creation, status polling, approval, rejection, cancellation, and one-time session issuance.
Originally posted by: thomijasir
This is now tracked in [#141], together with OIDC single sign-on (#121).
dopbase login --browserprints the approval link and code,--browser-openalso opens the browser (replacing the proposed--no-open), and it works on servers with or without single sign-on. The pull request for [#141] will close this issue.Related
Tickets:
#141Ticket changed by: dopbase