cli(login): add `--no-browser` flag to suppress auto-opening a browser during ChatGPT login

Resolved 💬 2 comments Opened Dec 28, 2025 by fkiller Closed Dec 28, 2025

What feature would you like to see?

What happened / problem statement

When running codex login (ChatGPT OAuth flow), the CLI attempts to automatically open the default browser. This is inconvenient (and sometimes impossible) in headless / remote / SSH environments, or when embedding the flow into another UI that needs to capture the auth URL and open it in a controlled browser context.

There is an open_browser toggle in the login server implementation (codex-rs/login/src/server.rs), but the CLI currently does not expose any flag to set it to false. Users can still copy/paste the printed URL, but the CLI always tries to open a browser first.

Why this is useful

  • Headless / remote machines: opening a local GUI browser is not viable.
  • SSH workflows: users may want to copy the URL and open it on their local machine (often via port-forwarding).
  • Embedded/controlled browser contexts: the application may want to intercept the URL and open it in an internal browser (or a specific browser profile), rather than the system default.

Proposed solution

Add a CLI flag to disable auto-open:

  • codex login --no-browser (or similar)
  • When enabled, do not attempt to launch a browser; print the auth URL with messaging optimized for manual copy/paste.

Additional context

I have a small patch ready that:

  • adds --no-browser to codex login
  • threads the flag through the ChatGPT login flow to the login server options
  • adjusts the printed message depending on whether auto-open is enabled
  • updates the authentication docs for headless setups

(Once this issue is created, I can open a PR that references it.)

Additional information

_No response_

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗