codex icon indicating copy to clipboard operation
codex copied to clipboard

Tracker: Codex business access-tokens broken (401 unauthorized)

Open cohereless opened this issue 6 months ago • 22 comments

What version of the Codex App are you using (From “About Codex” dialog)?

v0.135.0

What subscription do you have?

Business

What platform is your computer?

Linux

What issue are you seeing?

https://developers.openai.com/codex/enterprise/access-tokens no longer works. Fails on old versions and new versions of codex so it is likely server side.

codex exec "summarize the last release diff"
OpenAI Codex v0.135.0
--------
workdir: /workspaces/dev
model: gpt-5.5
provider: openai
approval: never
sandbox: read-only
reasoning effort: none
reasoning summaries: none
session id: redacted
--------
user
summarize the last release diff
warning: Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.
2026-05-30T08:58:22.421652Z ERROR codex_core::shell_snapshot: Shell snapshot validation failed: Snapshot command exited with status exit status: 2: /home/codespace/.codex/shell_snapshots/redacted: line 2547: syntax error near unexpected token `('

ERROR: Reconnecting... 2/5
ERROR: Reconnecting... 3/5
ERROR: Reconnecting... 4/5
ERROR: Reconnecting... 5/5
ERROR: Reconnecting... 1/5
ERROR: Reconnecting... 2/5
ERROR: Reconnecting... 3/5
ERROR: Reconnecting... 4/5
ERROR: Reconnecting... 5/5
ERROR: unexpected status 401 Unauthorized: {"detail":"Unauthorized"}, url: https://chatgpt.com/backend-api/codex/responses, cf-ray: redacted, request id: redacted
ERROR: unexpected status 401 Unauthorized: {"detail":"Unauthorized"}, url: https://chatgpt.com/backend-api/codex/responses, cf-ray: redacted, request id: redacted

What steps can reproduce the bug?

Reproduction:

  1. Generate a token in https://chatgpt.com/admin/access-tokens (only business/enterprise can do this)
  2. export CODEX_ACCESS_TOKEN='your token'
  3. curl -fsSL https://chatgpt.com/codex/install.sh | sh (only if you don't have codex yet)
  4. codex exec "Test, respond OK." (ensure you are not logged in already!)

If anyone manages to execute the above successfully, leave a comment as well.

The issue was fully reproduced in a github codespace as well, as well as on my local environment. Following the above steps should allow for a full reproduction in a github codespace, unless my account in particular is broken.

What is the expected behavior?

The codex session should respond OK, and not time out.

Additional information

No response

cohereless avatar May 30 '26 09:05 cohereless

Had a friend from a different company reproduce this on macos. Definitely a valid issue and I believe it affects all business/enterprise users. Surprised it's not tracked harder as this has started like 24 hours ago.

cohereless avatar May 30 '26 09:05 cohereless

Seems broken, getting the same 401 error with old/fresh CODEX_ACCESS_TOKEN

dbader avatar Jun 01 '26 13:06 dbader

Same issue here. getting 401 from codex backend.

scubedoo187 avatar Jun 02 '26 07:06 scubedoo187

Same. I perform this command to login

printenv CODEX_ACCESS_TOKEN | codex login --with-access-token

nixdrey-mf avatar Jun 02 '26 09:06 nixdrey-mf

This started a few days back out of nowhere and is currently blocking our CI review pipeline: Ubuntu 24.04 with Codex v0.136.0. We have already tried generating new tokens and even generating a new codex seat. I have logged out, removed cache, and re-logged in several times. Same issue.

michaelgruner avatar Jun 02 '26 21:06 michaelgruner

Also reproduced on Codex CLI v0.136.0 using a Business access token.

Auth file after:

printenv CODEX_ACCESS_TOKEN | codex login --with-access-token

contains:

{
  "auth_mode": "agentIdentity",
  "OPENAI_API_KEY": null,
  "agent_identity": "<redacted>"
}

Command:

printenv CODEX_ACCESS_TOKEN | codex login --with-access-token
CODEX_HOOKS_DISABLED=1 codex exec --json "say hello"

Observed:

Reading access token from stdin...
Successfully logged in
{"type":"thread.started","thread_id":"<redacted>"}
{"type":"turn.started"}
{"type":"error","message":"Reconnecting... 2/5 (stream disconnected before completion: failed to send websocket request: Connection closed normally)"}
{"type":"error","message":"Reconnecting... 3/5 (stream disconnected before completion: failed to send websocket request: Connection closed normally)"}
{"type":"error","message":"Reconnecting... 4/5 (stream disconnected before completion: failed to send websocket request: Connection closed normally)"}
{"type":"error","message":"Reconnecting... 5/5 (stream disconnected before completion: failed to send websocket request: Connection closed normally)"}
{"type":"error","message":"Reconnecting... 1/5 (unexpected status 401 Unauthorized: {\"detail\":\"Unauthorized\"}, url: https://chatgpt.com/backend-api/codex/responses, cf-ray: <redacted>, request id: <redacted>)"}
{"type":"error","message":"Reconnecting... 2/5 (unexpected status 401 Unauthorized: {\"detail\":\"Unauthorized\"}, url: https://chatgpt.com/backend-api/codex/responses, cf-ray: <redacted>, request id: <redacted>)"}
{"type":"error","message":"Reconnecting... 3/5 (unexpected status 401 Unauthorized: {\"detail\":\"Unauthorized\"}, url: https://chatgpt.com/backend-api/codex/responses, cf-ray: <redacted>, request id: <redacted>)"}
{"type":"error","message":"Reconnecting... 4/5 (unexpected status 401 Unauthorized: {\"detail\":\"Unauthorized\"}, url: https://chatgpt.com/backend-api/codex/responses, cf-ray: <redacted>, request id: <redacted>)"}
{"type":"error","message":"Reconnecting... 5/5 (unexpected status 401 Unauthorized: {\"detail\":\"Unauthorized\"}, url: https://chatgpt.com/backend-api/codex/responses, cf-ray: <redacted>, request id: <redacted>)"}
{"type":"error","message":"unexpected status 401 Unauthorized: {\"detail\":\"Unauthorized\"}, url: https://chatgpt.com/backend-api/codex/responses, cf-ray: <redacted>, request id: <redacted>"}
{"type":"turn.failed","error":{"message":"unexpected status 401 Unauthorized: {\"detail\":\"Unauthorized\"}, url: https://chatgpt.com/backend-api/codex/responses, cf-ray: <redacted>, request id: 146c3f5b-26ee-44cf-ae37-7f5cb4fd96e1"}}

Final request ID from this repro:

146c3f5b-26ee-44cf-ae37-7f5cb4fd96e1

kylebrague avatar Jun 02 '26 22:06 kylebrague

Image

meglinge avatar Jun 03 '26 04:06 meglinge

My existing access tokens seem to work again. For some reason I can't change my access tokens anymore though:

Access token creation is disabled
Enable "Allow users to create personal access tokens" in ChatGPT > Admin > Permissions & roles > Access tokens to let workspace members create access tokens.

I can't even revoke them! That setting does not show up on the dashboard.

cohereless avatar Jun 09 '26 19:06 cohereless

Exact same problem, on a business account and getting "Access token creation is disabled" but there's no "Permissions & roles" setting to toggle

dbader avatar Jun 09 '26 20:06 dbader

https://chatgpt.com/admin/access-tokens

Image

Button goes to https://chatgpt.com/admin/permissions, but there is no "Allow users to create personal access tokens" setting, all I can see for "token" related results is a "token expiration" setting:

Image

dbader avatar Jun 15 '26 10:06 dbader

Getting the same on a paid business account. I re-login, send couple messages in Codex - revoked again. Both seats getting revoked. When logging in, have to "confirm the phone" every time now. OpenAI seems to hate its paying customers.

Very disappointed. Thinking about moving to Claude.

MoralStrike avatar Jun 17 '26 05:06 MoralStrike

Didn't get to use these accounts at all. Yet, can't even request a refund:

So, OpenAI took my money, won't let me use Codex, and I can't even request a refund?

Image

MoralStrike avatar Jun 17 '26 05:06 MoralStrike

Image

The setting is now visible, but no flag to actually set it yet.

This feature rollout has arguably been insane from a professionalism perspective... Feels like an intern is in charge of it.

cohereless avatar Jun 17 '26 14:06 cohereless

The setting has now become settable! 🥳 Sadly, the new tokens still don't work:

The new token does not improve things. Tested both documented paths in an isolated CODEX_HOME:

  - codex login --with-access-token fails with personal access token metadata request failed with status 403 Forbidden.
  - CODEX_ACCESS_TOKEN=... codex exec ... fails with the same 403 before any run starts.

cohereless avatar Jun 19 '26 12:06 cohereless

Same, I can generate new tokens (now with the at-... prefix). I can echo "<TOKEN>" | codex login --with-access-token but then any prompts inside Codex still fail with the following error:

Codex CLI v0.141.0 error:

■ stream disconnected before completion: You didn't provide an API key. You need
to provide your API key in an Authorization header using Bearer auth (i.e.
Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if
you're accessing the API from your browser and are prompted for a username and
password. You can obtain an API key from
https://platform.openai.com/account/api-keys.

dbader avatar Jun 22 '26 12:06 dbader

Business Accounts for OAUTH are broken completely, a lot of users including me are facing frequent (hourly, daily) revokation of oauth tokens without sharing any accounts across multiple machines. We just use two busines seats from the same workspace and switch the account by "rotating" the auth.json between codex-sessions... OpenAI doesnt seem to like paying customers...

bjspi avatar Jul 05 '26 09:07 bjspi

If someone else is completely blocked by this, it seems like using the OpenAI API token (as opposed to the Codex API token) works ok. Use the --with-api-token option. It's less than ideal, but it's something...

michaelgruner avatar Jul 05 '26 21:07 michaelgruner

What version of the Codex App are you using (From “About Codex” dialog)? codexcli v0.142.5

What subscription do you have? Business

same issue for my team, please fix it as soon as possible. I promoted the company to use Codex Business, but this problem occurs frequently, which has made my colleagues very disgusted. They hope to switch to Claude. This is the commercial version, why would such a basic problem occur? No commercial company should treat business customers like this.

First of all, business clients and ordinary users have different usage patterns. We will purchase multiple business accounts, but some people only use GPT (for example, non-programmers), while programmers use Codex CLI. We will use a gateway similar to codex-lb to allocate the Codex quota to programmers across the entire company, so as to balance expenses. But now there is a widespread problem of being forced to log in again, which has caused great trouble to our company's operation and maintenance.

william-best avatar Jul 06 '26 09:07 william-best

ANY FIX PLANNED? Or does openai just ignore paying customers?

bjspi avatar Jul 14 '26 18:07 bjspi

Fully works again on our business, leaving tracker open for other users as it appears that others still have some issue.

cohereless avatar Jul 15 '26 06:07 cohereless