Sign in with Device Code fails to display code and loops back to the selection menu on headless servers.

Open 💬 5 comments Opened Feb 21, 2026 by Eric-Terminal
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of Codex CLI is running?

codex-cli 0.104.0

What subscription do you have?

ChatGPT Business

Which model were you using?

gpt-5.3-codex

What platform is your computer?

Linux 6.12.69+deb13-amd64 x86_64 unknown

What terminal emulator and version are you using (if applicable)?

iTerm2 (SSH session to Server)

What issue are you seeing?

When running codex and selecting option 2. Sign in with Device Code, the CLI does not display the verification code or the authentication URL. Instead, the screen flickers/clears and immediately returns to the initial "Welcome to Codex" selection menu.

What steps can reproduce the bug?

  1. Run codex on a headless Linux server via SSH.
  2. Navigate to the login selection menu.
  3. Select Sign in with Device Code.
  4. Observe the menu refreshing instead of providing the OAuth device code flow information.

What is the expected behavior?

The CLI should provide a user code (e.g., ABCD-1234) and a URL (e.g., https://open.ai/verify) to allow for out-of-band authentication from another device.

Additional information

It seems the TUI (Terminal User Interface) might be failing to handle the transition to the device code display state, or it’s attempting to trigger a browser-based flow as a fallback and failing silently before returning to the main loop.

View original on GitHub ↗

5 Comments

github-actions[bot] contributor · 6 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #10970

Powered by Codex Action

Eric-Terminal · 6 months ago

This looks like it might be due to my IP. I’m not sure if this is expected behavior, but my server is based in Hong Kong.

<img width="714" height="515" alt="Image" src="https://github.com/user-attachments/assets/8fe4ace7-d4c7-4ba6-b219-3291371e9a62" />

karatuno · 6 months ago

Same Hong server here. is this expected?

Eric-Terminal · 6 months ago

OpenAI doesn’t allow access from places like mainland China and Hong Kong, right? It gets a 403 error at Cloudflare’s edge nodes.

Eric-Terminal · 6 months ago

The expected behavior of this program should be to throw an error and exception if it encounters a failure at this step, rather than directly returning to the main interface like this. That makes troubleshooting more difficult.