openai / openai/codex

Codex Desktop macOS authentication fails: browser bridge cannot open OAuth URL and callback listener is not started

Open
#40,959 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app auth bug
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

Summary

Codex Desktop on macOS cannot complete ChatGPT authentication.

The app generates a valid OAuth URL but fails to open it through its internal browser bridge:

[link-opening] Failed to open link
errorMessage="Failed to open URL"
initiator=open_in_browser_bridge

At the same time, the expected local OAuth callback listener on localhost:1455 is not started.

Because of this, I cannot sign in to Codex Desktop at all.

Environment

  • macOS: 26.6.1
  • Apple Silicon Mac
  • Codex / ChatGPT Desktop version: 26.820.60940
  • Bundle version: 7119
  • Bundle identifier: com.openai.codex
  • URL scheme registered by the app: codex://

Background

I had been using Codex Desktop normally for some time.

Before this authentication failure occurred, I had already noticed a related issue: opening Profile from Codex settings sometimes failed with a macOS application/opening error.

Later I changed the email address on my OpenAI account. This invalidated the existing Codex session, which is expected.

After that, Codex required me to sign in again, but the desktop authentication flow no longer worked.

I do not think changing the email itself is necessarily the root cause, because the external-link/Profile opening problem existed before the email change. The email change appears to have invalidated the old session and exposed the existing authentication/open-link issue.

Actual behavior

When Codex starts, the previous refresh token is rejected:

Failed to refresh token: 401 Unauthorized

"Your session has ended. Please log in again."

code: "refresh_token_invalidated"

The app then reports that no valid ChatGPT token is available:

app_server_connection.auth_status_result
authMethod=chatgpt
hasToken=false
nullReason=auth_token_missing
refreshToken=true
tokenExpiryState=missing

Backend requests subsequently fail with 401 Unauthorized, for example:

desktop_fetch_auth_401
target="GET https://chatgpt.com/backend-api/wham/accounts/check"

and:

chatgpt-account-lookup
accountsHttpStatus=401
authenticatedAccountPresent=false
failureType=account_info_token_unavailable

When I press Sign in with ChatGPT, Codex creates an OAuth URL but fails to open it:

[link-opening] Failed to open link
conversationId=undefined
errorMessage="Failed to open URL"
errorName=Error
initiator=open_in_browser_bridge
url=https://chatgpt.com/codex/desktop-auth?authorize_url=...

The OAuth redirect URI generated by Codex is:

http://localhost:1455/auth/callback

However, immediately after triggering login, there is no process listening on port 1455.

Command:

lsof -nP -iTCP:1455 -sTCP:LISTEN

Result:

(no output)

So the app appears to both:

  1. fail to open the OAuth URL through open_in_browser_bridge;
  2. fail to start the local callback listener on port 1455.

Important diagnostic detail

Opening normal HTTPS URLs from macOS works correctly.

Both of these commands successfully open the browser:

open "https://chatgpt.com"
open -a Safari "https://chatgpt.com"

So the system HTTP/HTTPS handler itself appears to work.

The problem seems specific to Codex Desktop's internal browser-opening/authentication flow.

Steps to reproduce

  1. Install Codex / ChatGPT Desktop on macOS.
  2. Start the app while no valid ChatGPT session exists.
  3. Click Sign in with ChatGPT.
  4. Codex attempts to start OAuth.
  5. The app fails to open the authentication URL.
  6. Authentication cannot proceed.
  7. localhost:1455 is not listening for the OAuth callback.

Expected behavior

Clicking Sign in with ChatGPT should:

  1. start the local callback listener;
  2. open the authentication URL in the default browser;
  3. complete OAuth;
  4. return the session to Codex Desktop;
  5. sign the user into the existing ChatGPT account.

What I already tried

I have already tried all of the following:

  • completely quitting the app;
  • removing ChatGPT/Codex;
  • removing associated application data;
  • reinstalling the latest version;
  • rebooting macOS;
  • re-registering the app with Launch Services;
  • verifying the codex:// URL scheme;
  • testing the app executable directly;
  • testing normal HTTP/HTTPS URL opening;
  • temporarily removing OPENAI_API_KEY from the shell environment;
  • retrying authentication after all of the above.

A full clean reinstall and reboot did not fix the issue.

Launch Services / bundle checks

The installed app reports:

CFBundleShortVersionString = 26.820.60940
CFBundleIdentifier = com.openai.codex

Its URL schemes include:

codex
http
https

The executable is present and valid:

/Applications/ChatGPT.app/Contents/MacOS/ChatGPT:
Mach-O 64-bit executable arm64

Additional note

Before the current login failure, opening Profile from Codex settings could also trigger an application-opening error. This may indicate that the same open_in_browser_bridge / external-link handling issue existed before the authentication session was invalidated.

Please let me know if there are additional logs or diagnostics I can provide.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files or tests are named in the report. Start by tracing the macOS Sign in with ChatGPT entry point, the open_in_browser_bridge path, and the localhost:1455 callback listener; reproduce the failure and use lsof to check the listener. Done means the OAuth URL opens, the callback listener starts, and authentication completes.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, rust
Domain
authentication, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.