Skip to content

cli(login): add --no-browser flag for ChatGPT login - #8577

Closed
fkiller wants to merge 2 commits into
openai:mainfrom
fkiller:main
Closed

fkiller wants to merge 2 commits into
openai:mainfrom
fkiller:main

Conversation

@fkiller

@fkiller fkiller commented Dec 28, 2025

Copy link
Copy Markdown

Fixes #8576

Summary

This PR adds a --no-browser flag to the codex login command to suppress automatically opening the default browser during the ChatGPT OAuth login flow.

Motivation

In headless / remote / SSH environments (or when embedding login into a controlled browser context), auto-opening a browser is not desirable and sometimes impossible. Users typically want the CLI to print the auth URL so they can open it in any browser they have access to.

What changed

  • CLI: Adds --no-browser to codex login.
  • Login flow: Threads an open_browser boolean through the ChatGPT login path and applies it to the login server options.
  • UX: Adjusts the login message depending on whether open_browser is enabled (auto-open vs manual open).
  • Docs: Updates docs/authentication.md to mention --no-browser for headless setups.

Testing

  • cargo fmt
  • cargo clippy -p codex-cli --tests
  • cargo clippy -p codex-login --tests

Notes

Default behavior is unchanged: without --no-browser, the CLI continues to auto-open the browser as before.

@github-actions

github-actions Bot commented Dec 28, 2025 •

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@fkiller

fkiller commented Dec 28, 2025

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@LIHUA919 LIHUA919 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.

LGTM

@etraut-openai

Copy link
Copy Markdown
Contributor

We've updated our contribution guidelines to clarify that we're currently accepting contributions for bugs and security fixes, but we're not generally accepting new features at this time. We need to make sure that all new features compose well with both existing and upcoming features and fit into our roadmap. If you would like to propose a new feature, please file or upvote an enhancement request in the issue tracker. We will generally prioritize new features based on community feedback.

swordfish444 pushed a commit to swordfish444/codex that referenced this pull request Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants