-
Notifications
You must be signed in to change notification settings - Fork 32
add manual login mode for headless auth flows #132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f82a748
3953d5d
5972554
fb6d5fb
e333972
c122ed0
8b5e6bc
3ef32f1
bccd043
56ea657
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -109,6 +109,21 @@ codex auth fix --dry-run | |
| codex auth doctor --fix | ||
| ``` | ||
|
|
||
| If the shell should not launch a browser, use the manual callback flow: | ||
|
|
||
| ```bash | ||
| codex auth login --manual | ||
| CODEX_AUTH_NO_BROWSER=1 codex auth login | ||
| ``` | ||
|
|
||
| In non-TTY/manual shells, provide the full redirect URL on stdin instead of waiting for a browser callback: | ||
|
|
||
| ```bash | ||
| echo "http://127.0.0.1:1455/auth/callback?code=..." | codex auth login --manual | ||
| ``` | ||
|
Comment on lines
+119
to
+123
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do not teach users to put the callback url on the command line.
🤖 Prompt for AI Agents |
||
|
|
||
| No new npm scripts or storage migration steps are required for this login-flow update. | ||
|
|
||
| --- | ||
|
|
||
| ## Command Toolkit | ||
|
|
@@ -234,6 +249,7 @@ codex auth login | |
| - `codex auth` unrecognized: run `where codex`, then follow `docs/troubleshooting.md` for routing fallback commands | ||
| - Switch succeeds but wrong account appears active: run `codex auth switch <index>`, then restart session | ||
| - OAuth callback on port `1455` fails: free the port and re-run `codex auth login` | ||
| - Browser launch is blocked or you are in a headless shell: re-run `codex auth login --manual` or set `CODEX_AUTH_NO_BROWSER=1` | ||
| - `missing field id_token` / `token_expired` / `refresh_token_reused`: re-login affected account | ||
|
|
||
| </details> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,7 +54,9 @@ User-facing capability map for `codex-multi-auth`. | |
| | Quick switch and search hotkeys | Faster navigation in the dashboard | | ||
| | Account action hotkeys | Per-account set, refresh, toggle, and delete shortcuts | | ||
| | In-dashboard settings hub | Runtime and display tuning without editing files directly | | ||
| | Browser-first OAuth with manual fallback | Works in normal and constrained terminal environments | | ||
| | Browser-first OAuth with manual fallback | `codex auth login` stays browser-first, while `--manual`, `--no-browser`, and `CODEX_AUTH_NO_BROWSER=1` keep login usable in browser-restricted shells | | ||
|
|
||
| Manual/non-TTY login accepts the full callback URL on stdin, so automation and host-managed shells can complete auth without relying on a local browser handoff. | ||
|
Comment on lines
+57
to
+59
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mention callback-listener failures here too.
as per coding guidelines, 🤖 Prompt for AI Agents |
||
|
|
||
| --- | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,6 +45,7 @@ Compatibility aliases are supported: | |
|
|
||
| | Flag | Applies to | Meaning | | ||
| | --- | --- | --- | | ||
| | `--manual`, `--no-browser` | login | Skip browser launch and use manual callback flow | | ||
| | `--json` | verify-flagged, forecast, report, fix, doctor | Print machine-readable output | | ||
| | `--live` | forecast, report, fix | Use live probe before decisions/output | | ||
| | `--dry-run` | verify-flagged, fix, doctor | Preview without writing storage | | ||
|
|
@@ -55,11 +56,23 @@ Compatibility aliases are supported: | |
|
|
||
| --- | ||
|
|
||
| ## Upgrade Notes | ||
|
|
||
| - `codex auth login` remains browser-first by default. | ||
| - `codex auth login --manual` and `codex auth login --no-browser` force the manual callback flow instead of launching a browser. | ||
| - `CODEX_AUTH_NO_BROWSER=1` suppresses browser launch for automation/headless sessions. False-like values such as `0` and `false` do not disable browser launch by themselves. | ||
| - In non-TTY/manual shells, pass the full redirect URL on stdin, for example: `echo "http://127.0.0.1:1455/auth/callback?code=..." | codex auth login --manual`. | ||
| - No new npm scripts or storage migration steps were introduced for this auth-flow update. | ||
|
|
||
| --- | ||
|
Comment on lines
+59
to
+67
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. documentation phrasing may mislead operators on env precedence. line 63 says "False-like values such as per if (explicitNoBrowser.length > 0) {
return NO_BROWSER_TRUTHY_VALUES.has(explicitNoBrowser);
}this means result: consider clarifying: "Setting 🤖 Prompt for AI Agents |
||
|
|
||
| ## Compatibility and Non-TTY Behavior | ||
|
|
||
| - `codex` remains the primary wrapper entrypoint. It routes `codex auth ...` and the compatibility aliases to the multi-auth runtime, and forwards every other command to the official `@openai/codex` CLI. | ||
| - In non-TTY or host-managed sessions, including `CODEX_TUI=1`, `CODEX_DESKTOP=1`, `TERM_PROGRAM=codex`, or `ELECTRON_RUN_AS_NODE=1`, auth flows degrade to deterministic text behavior. | ||
| - The non-TTY fallback keeps `codex auth login` predictable: it defaults to add-account mode, skips the extra "add another account" prompt, and auto-picks the default workspace selection when a follow-up choice is needed. | ||
| - `codex auth login --manual` keeps the login flow usable in browser-restricted shells by printing the OAuth URL and accepting manual callback input instead of trying to open a browser. | ||
| - In non-TTY/manual shells, provide the full redirect URL on stdin, for example: `echo "http://127.0.0.1:1455/auth/callback?code=..." | codex auth login --manual`. | ||
|
|
||
| --- | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
document the windows syntax for
CODEX_AUTH_NO_BROWSER.lib/auth/browser.ts:25-32makesCODEX_AUTH_NO_BROWSERa cross-platform toggle, and the suppression behavior is covered intest/browser.test.ts:76-82. the example here is posix-only, so windows users copying it from powershell or cmd will not actually set the variable. please add a powershell example here, and mirror it indocs/getting-started.md:61-64.as per coding guidelines,
docs/**: keep README, SECURITY, and docs consistent with actual CLI flags and workflows. whenever behavior changes, require updated upgrade notes and mention new npm scripts.suggested fix
codex auth login --manual CODEX_AUTH_NO_BROWSER=1 codex auth login +$env:CODEX_AUTH_NO_BROWSER="1"; codex auth login🤖 Prompt for AI Agents