Enable Signing in with ChatGPT account for browserless machines

Resolved 💬 12 comments Opened Aug 7, 2025 by LuigiPagani Closed Oct 28, 2025
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

0.16

Description

Codex CLI can’t complete “Sign in with ChatGPT” on browserless/headless machines (e.g., Codespaces, remote VMs/SSH, CI, WSL, Firebase Studio–style setups). It hangs at “Press Enter to continue” and never shows a device code or copyable auth URL. Claude code support it

View original on GitHub ↗

12 Comments

id82 · 11 months ago

Works on WSL, first set WSL to use your windows browser e.g.

export BROWSER="/mnt/c/Program Files/Google/Chrome/Application/chrome.exe"

Then proceed as normal.

karlbohlmark · 11 months ago

Yes, it works comically badly compared to claude code, but my tip is to authenticate on your laptop/desktop and then to copy over the auth.json file to the remote server

LuigiPagani · 11 months ago

Yes I have found a workaround but would be great to have a proper solution like cloud code

bsturk · 11 months ago
Yes, it works comically badly compared to claude code, but my tip is to authenticate on your laptop/desktop and then to copy over the auth.json file to the remote server

How do you do this (auth and get an auth.json, and where do you put it?). I've been tearing my hair out today trying to get this going. I've got ssh tunnels going, all kinds of stuff. Nothing has worked.

LuigiPagani · 11 months ago

Also qwen code has a much better solution Via qr code

milanglacier · 11 months ago

When attempting to log in to a remote server via SSH using my personal ChatGPT Plus account, the authentication process fails.

The error occurs after pasting the provided URL into my local browser.

<img width="887" height="375" alt="Image" src="https://github.com/user-attachments/assets/8d9fe4ca-6b4c-4f4c-bd6c-ff5f1dd50b7a" />

fgn · 10 months ago

I also hit this issue. Here is a workaround.

First: Set Up an SSH Tunnel from Your Local Machine

Run the following command from your local machine's terminal. This creates a tunnel that forwards port 1455 on your local machine to port 1455 on the remote (headless) machine:

ssh -N -f -L 1455:127.0.0.1:1455 <user>@<remote-host>

Then: Complete Authentication Through Your Browser

  • Start Codex on your remote (headless) machine. It will provide a URL for authentication.
  • Copy this URL and open it in your local browser (e.g., Chrome or Firefox).
  • Proceed through the authentication steps.

The authentication requests will now be forwarded securely through the SSH tunnel back to your remote VM, completing the sign-in.

EDIT:
Just found the answer in the docs https://github.com/openai/codex/blob/main/docs/authentication.md#connecting-on-a-headless-machine

LuigiPagani · 10 months ago

@fgn Yes there are many workarpounds, also copying the configuration json. This issue is though for "asking" a proper solution

fgn · 10 months ago
@fgn Yes there are many workarpounds, also copying the configuration json. This issue is though for "asking" a proper solution

Yes indeed, a proper fix is exactly what we want. A search engine led me here instead of the documentation, and the auth.json solution didn't work in my case. Until this is resolved properly, I wanted to help others landing here with the same issue.

vanpelt · 10 months ago

+1

Telling users to manually copy around a very sensitive auth file seems worse than the phishing risk of an OOB token like Claude supports. The "correct" way to support this is the Device Code Flow as mentioned above, but the user experience of OOB is better. Without this functionality, usage of Codex in CodeSpaces or fully isolated VM's is brutal 😭

etraut-openai contributor · 8 months ago

We're using this issue to track this request, so I'm going to close this issue. Please refer to the other issue for updates.