Codex CLI cannot log in on headless environments unless Device Code auth is enabled by workspace admin
What version of Codex is running?
0.84.0
What subscription do you have?
ChatGPT Team / Workspace (Codex enabled)
Which model were you using?
5.2-codex
What platform is your computer?
Linux 5.15.0-138-generic x86_64 x86_64
What terminal emulator and version are you using (if applicable)?
SSH terminal on Ubuntu (no GUI)
What issue are you seeing?
Description:
Codex CLI authentication behaves inconsistently depending on environment.
On local machines with a GUI, login works as expected. On headless environments (SSH servers, containers, remote dev machines), Codex CLI forces Device Code authentication and fails with:
"Please contact your workspace admin to enable device code authentication"
This blocks Codex usage entirely unless a workspace admin explicitly enables a specific OAuth flow.
This is problematic because:
- The same user with the same workspace permissions can or cannot use Codex depending solely on environment.
- Headless environments (servers, containers, CI) are primary developer workflows.
- Login capability should be determined by user permissions, not by admin approval of a specific OAuth grant.
Expected behavior: Authorized workspace users should be able to authenticate in headless environments without requiring additional admin approval, or Codex CLI should provide an equivalent non-device-code login flow.
What steps can reproduce the bug?
Steps to reproduce:
-
Log in to a headless Linux environment (e.g. SSH into a server, container, or remote dev machine with no GUI).
-
Ensure you are a valid member of a ChatGPT Workspace with Codex access.
-
Run the following command:
codex login
or explicitly:
codex login --device-auth
-
Observe that authentication fails with the error: "Please contact your workspace admin to enable device code authentication"
-
Repeat the same login on a local machine with a GUI and browser access.
-
Observe that login succeeds in the GUI environment.
Explanation:
Codex CLI forces Device Code authentication in headless environments. If Device Code authentication is disabled at the workspace level, login fails entirely, even though the same user is authorized and can use Codex in GUI environments.
This creates an environment-dependent authentication failure where the same user has different effective permissions depending on whether a GUI is available.
What is the expected behavior?
No response
Additional information
No response
Additional context:
The current Codex CLI does not provide any browser-based or interactive login option.
Output of codex login --help shows that the only supported authentication methods are:
--device-auth(OAuth Device Code flow)--with-api-key(API key via stdin)
There is no --browser, --interactive, or similar option that would allow a
standard OAuth browser login with a local callback.
This is important because if a browser-based login option existed, it would be possible to authenticate even in remote/headless environments by using common workarounds such as:
- VS Code Remote / integrated browser
- SSH port forwarding to a local browser
- Remote development environments with forwarded callbacks
In previous workflows (and in other developer tools), browser-based OAuth login works correctly in these scenarios. However, because Codex CLI currently forces Device Code authentication in headless environments and offers no alternative, users are completely blocked when Device Code auth is disabled at the workspace level.
In short:
- Browser-based login is not available in Codex CLI
- Device Code auth is mandatory in headless environments
- When Device Code auth is disabled, there is no viable login path, even though the user is authorized and could authenticate via a browser if such an option existed
Please refer to our authentication documentation, which offers multiple fallback techniques if device code authentication isn't an option.
FWIW you can fudge this by running DISPLAY=nothing codex and unsetting SSH-related environment variables, which will make the old non-headless login flow trigger, which still works, albeit every bit as poorly as it ever did.
https://github.com/openai/codex/blob/1fc72c647fd52e3e73d4309c3b568d4d5fe012b5/codex-rs/core/src/env.rs#L29
Imagine paying for a feature you can’t use.
$ unset CI SSH_CONNECTION SSH_CLIENT SSH_TTY
$ export DISPLAY=:0
$ codex
Your codex cli is trying to do headless login and device auth is supported only using the browser. You have to login using browser environment and copy the auth.json file to your headless server.
There is a fix to be released with the update soon i believe https://github.com/openai/codex/pull/9333
There is a fix to be released with the update soon i believe #9333
Not sure what you are referring to.
codex-rs rolled out a client-side change that was, conceptually, a good idea, except the server part is extremely half baked and doesn’t actually work (yet?) for business customers. Classic release management error.
Unless the server side will be fixed extremely quickly, presumably the right solution would be for codex-rs to release a fix that temporarily disables the new feature until the server side is ready. And then re-enable it whenever the server part is fully deployed and all the relevant admin settings are documented.
@amluto, we deployed a server-side fix a few hours ago. Please give it a try when you have a chance, and let us know if it's working for you now.
@amluto, we deployed a server-side fix a few hours ago. Please give it a try when you have a chance, and let us know if it's working for you now.
(codex-rs is not needed to test this: just navigating to https://auth.openai.com/codex/device is sufficient)
If I go to the device auth page, it still says "Please contact your workspace admin to enable device code authentication". On that page, if I change my desired sign in to my personal account (which I suspect is some old free tier thing I never use on account of using ChatGPT and Codex exclusively via a workspace account), it gives me this message:
Enable device code authorization for Codex in ChatGPT Security Settings, then run "codex login --device-auth" again.
If I click that link, I get a page that has no such setting. But I kind of expected that because the actual error said that the workspace admin needed to do it.
The workspace admin in question is me. So I went to https://admin.openai.com and looked at literally every setting I could find (there are very few of them), and none of them look even remotely relevant.
So I would rate this as not fixed yet.
Reopening issue. We'll investigate.
Correct. There is no setting anywhere to be enabled. This works on Personal account though. Business only issue. And very annoying.
I am the workspace admin and even though I have approved device auth code login it still tells me that an administrator needs to enable it. This is an enterprise account.
I have the same issue. Using codex-cli 0.87.0. I tried to degrade it to 0.81.0 but no change.
v0.88.0 seems to solve the issue
v0.88 not helping on my side, I'm still not seeing the setting in business plan (do see it on personal plan)
v0.88.0 seems to solve the issue
The problem is with OpenAI's login system, not with codex-rs per se. You can reproduce the problem easily by going to https://auth.openai.com/codex/device without any interaction with codex-rs.
@etraut-openai, this issue is going on two weeks with no apparent resolution. I've been working in parallel with the account support people, and they seem completely unable to comprehend the issue despite my sending them lots of descriptions and even a screencast. At what point should codex-rs revert the change or add an extra explicitly prompted option to use the non-headless mode while waiting for the server side to get fixed?
Imagine if Microsoft released a fancy update to the Excel application on Windows (whatever they call it these days) that switched half the users, by default, with no obvious fallback, to Improved Excel Signin, that was unable to log into business tier Microsoft online account because the online account team had forgotten to add the little checkbox "allow your users to use Improved Excel Signin"? Sure, the bug would technically be on the online account side, but I think the client people would seriously consider reverting or working around the problem while waiting for the server people to fix the settings.
@amluto, apologies for the delay. As you point out, the fix for this issue isn't in the Codex clients. It involves a change to the main ChatGPT site. The fix is in the works and should be deployed soon. Thanks for your patience.
i know you're working on it, i just want to report +1 (if that helps)
We are ChatGPT Business subscription with 11 users, this is a really annoying issues for us. I am the owner, kept receiving pings from users regarding this issue, but no idea how to enable this, the bot did not provide any workaround at all.
The workspace login issue should have been fixed, please try again and let us know how it goes. If you are an admin and need to toggle it on, you can find the toggle here in you workspace settings page: