codex icon indicating copy to clipboard operation
codex copied to clipboard

Logging in with ChatGPT failing

Open ProCreations-Official opened this issue 1 year ago • 11 comments

What version of Codex is running?

codex-cli 0.16.0

Which model were you using?

No response

What platform is your computer?

Darwin 25.0.0 arm64 arm

What steps can reproduce the bug?

Install Codex Cli, login with chatgpt

What is the expected behavior?

Logs in and authenticates properly

What do you see instead?

Error response

Error code: 500

Message: Token exchange failed: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1028)>.

Error code explanation: 500 - Server got itself in trouble.

Additional information

No response

ProCreations-Official avatar Aug 07 '25 18:08 ProCreations-Official

Are you on a headless machine?

If so, please see https://github.com/openai/codex/issues/1243#issuecomment-3165318852

bolinfest avatar Aug 07 '25 18:08 bolinfest

Are you on a headless machine?

If so, please see #1243 (comment)

Not on headless, on MacBook with everything setup (display, keyboard, trackpad)

ProCreations-Official avatar Aug 07 '25 18:08 ProCreations-Official

Hmm, what is python3 -V?

bolinfest avatar Aug 07 '25 18:08 bolinfest

(Also just confirming that you aren't trying to use this in a Docker container, despite being on a Mac.)

bolinfest avatar Aug 07 '25 18:08 bolinfest

same problem! Error Message in Codex: Error logging in: login_with_chatgpt subprocess failed:

ghost avatar Aug 07 '25 18:08 ghost

i was getting error 500 on macOS like the original post, this following steps fixed the issue for me:

  1. Make sure pip is available python3 -m ensurepip --upgrade

  2. Upgrade certifi for the latest CA bundle python3 -m pip install --upgrade certifi

  3. Point SSL_CERT_FILE to certifi’s bundle export SSL_CERT_FILE="$(python3 -c 'import certifi; print(certifi.where())')"

  4. Run the login flow again codex login

Just sharing what worked on my machine, run at your own discretion.

linpatr avatar Aug 07 '25 19:08 linpatr

python3 -m ensurepip --upgrade Looking in links: /var/folders/wg/90ttqb114y1g4kqsrbt0fy8m0000gn/T/tmploamjnvc Requirement already satisfied: pip in /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages (24.3.1) ❯ python3 -m pip install --upgrade certifi Collecting certifi Downloading certifi-2025.8.3-py3-none-any.whl.metadata (2.4 kB) Downloading certifi-2025.8.3-py3-none-any.whl (161 kB) Installing collected packages: certifi Successfully installed certifi-2025.8.3

[notice] A new release of pip is available: 24.3.1 -> 25.2 [notice] To update, run: python3 -m pip install --upgrade pip ❯ export SSL_CERT_FILE="$(python3 -c 'import certifi; print(certifi.where())')" ❯ codex login Starting local login server on http://localhost:1455 . If your browser did not open, navigate to this URL to authenticate:

https://auth.openai.com/oauth/authorize? XXX Successfully logged in

Worked for me - Thanxs! For the fast Support!

ghost avatar Aug 07 '25 19:08 ghost

  • export SSL_CERT_FILE="$(python3 -c 'import certifi; print(certifi.where())')"

Worked, thank you!

ProCreations-Official avatar Aug 07 '25 19:08 ProCreations-Official

After logging in, I get #1960

ProCreations-Official avatar Aug 08 '25 03:08 ProCreations-Official

i was getting error 500 on macOS like the original post, this following steps fixed the issue for me:

  1. Make sure pip is available python3 -m ensurepip --upgrade
  2. Upgrade certifi for the latest CA bundle python3 -m pip install --upgrade certifi
  3. Point SSL_CERT_FILE to certifi’s bundle export SSL_CERT_FILE="$(python3 -c 'import certifi; print(certifi.where())')"
  4. Run the login flow again codex login

Just sharing what worked on my machine, run at your own discretion.

Worked for me. MacMini Sequoia 15.6

PeterPeet avatar Aug 09 '25 11:08 PeterPeet

For reference, the following method also worked:

pip3 install pip-system-certs

https://stackoverflow.com/a/77491061

msasaki666 avatar Aug 11 '25 04:08 msasaki666