Logging in with ChatGPT failing

Resolved 💬 11 comments Opened Aug 7, 2025 by ProCreations-Official Closed Aug 7, 2025
💡 Likely answer: A maintainer (bolinfest, collaborator) responded on this thread — see the highlighted reply below.

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_

View original on GitHub ↗

11 Comments

bolinfest collaborator · 11 months ago

Are you on a headless machine?

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

ProCreations-Official · 11 months ago
Are you on a headless machine? If so, please see #1243 (comment)

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

bolinfest collaborator · 11 months ago

Hmm, what is python3 -V?

bolinfest collaborator · 11 months ago

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

ghost · 11 months ago

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

pl728 · 11 months ago

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

  1. Upgrade certifi for the latest CA bundle

python3 -m pip install --upgrade certifi

  1. Point SSL_CERT_FILE to certifi’s bundle

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

  1. Run the login flow again

codex login

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

ghost · 11 months ago

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!

ProCreations-Official · 11 months ago
export SSL_CERT_FILE="$(python3 -c 'import certifi; print(certifi.where())')"

Worked, thank you!

ProCreations-Official · 11 months ago

After logging in, I get #1960

PeterPeet · 11 months ago
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

msasaki666 · 11 months ago

For reference, the following method also worked:

pip3 install pip-system-certs

https://stackoverflow.com/a/77491061