Codex VS Code extension cannot re-authenticate in Dev Container after successful initial login (token_exchange_failed)

Open 💬 2 comments Opened May 26, 2026 by MichaelDevine

What version of the IDE extension are you using?

26.519.32039

What subscription do you have?

Plus

Which IDE are you using?

VS Code

What platform is your computer?

Linux 6.6.114.1-microsoft-standard-WSL2 x86_64 x86_64

What issue are you seeing?

Codex connected successfully initially
Session expired / disconnected
Re-login fails permanently
Chat shows Codex Reconnecting...

Sign-in flow fails with:

Token exchange failed:
error sending request for url (https://auth.openai.com/oauth/token)

Container network is healthy:

curl -Iv https://auth.openai.com/oauth/token
succeeds with TLS + HTTP response

From the log:
401 /wham/usage
api key auth is not supported
chatgpt authentication required for remote plugin catalog
stream disconnected - retrying sampling request
token_exchange_failed

What steps can reproduce the bug?

  1. On Windows 11, open project folder with VS Code.
  2. Make sure you have a working .devcontainer config and can re-open the project in a Dev Container.
  3. Confirm by running ctrl-shift-p, and re-open in container.
  4. Install openai.chatgpt extension, if not already installed. This will first install it at host level.
  5. Install the extension in the container. The option to do this shows on the listing of the extension at host level.
  6. After the extension is installed, a "CODEX" tab will show up in the Chat panel.
  7. Click the "Sign in With Chat GPT" button.
  8. A browser will open, login in to ChatGPT if not already.
  9. When the page "Sign in to Codex with ChatGPT appears, click Continue.

You will see either a failure or a freeze that lasts forever in both the chat window and the web page.

Failure case:
<img width="764" height="358" alt="Image" src="https://github.com/user-attachments/assets/6773b7f0-b7e5-49b1-8c1d-06098d726a0b" />

Freeze case (never times out):

In this image I have clicked on the Continue button, and it goes gray and freezes.
<img width="637" height="622" alt="Image" src="https://github.com/user-attachments/assets/187e9f55-b8a2-4a1d-8ccf-a72c081a9730" />
And this is what the chat window looks like:

<img width="498" height="665" alt="Image" src="https://github.com/user-attachments/assets/0e0e9c4f-c12b-4f51-900b-062dbcda8c90" />

What is the expected behavior?

Existing working login should recover
Re-auth should succeed after disconnect
Dev Container auth state should not become unrecoverable

Additional information

_No response_

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗