Skip to content

[Bug]: openai-codex OAuth fails with 403 unsupported_country_region_territory while codex-cli works #51175

@wulala-xjj

Description

@wulala-xjj

Bug type

Behavior bug (incorrect output/state without crash)

Summary

OpenClaw latest version cannot complete openai-codex OAuth in my environment, while official codex-cli works on the same machine/network/account.

Environment:

  • macOS
  • Latest OpenClaw
  • Node v24.14.0

What I tested:

  1. Browser OAuth page opens normally.
  2. Local callback on localhost:1455 works.
  3. curl -I https://auth.openai.com/oauth/token reaches the endpoint and returns HTTP 405 when proxy is enabled.
  4. Official codex login succeeds on the same machine, same browser, same account, same network/proxy.
  5. openclaw models auth login --provider openai-codex consistently fails at code->token exchange with:
    403 unsupported_country_region_territory
  6. I also tested with:
    • http_proxy / https_proxy
    • ALL_PROXY
    • forcing Node proxy through global-agent preload
      Result is unchanged.

Conclusion:
This appears to be specific to OpenClaw's openai-codex OAuth/token exchange path rather than a general account/network/browser issue.

Steps to reproduce

  1. Run: openclaw models auth login --provider openai-codex
  2. Browser opens and login completes successfully
  3. Paste redirect URL back into CLI (or auto callback)
  4. OpenClaw fails during code->token exchange

Expected behavior

OAuth should complete successfully and return a valid token, similar to official codex-cli login.

Actual behavior

OpenClaw consistently fails with:

403 {"error":{"code":"unsupported_country_region_territory","message":"Country, region, or territory not supported"}}

while official codex login works on the same machine, same account, same network.

OpenClaw version

2026.3.13

Operating system

macOS14.2.1

Install method

npm全局

Model

glm-5

Provider / routing chain

OpenClaw CLI -> openai-codex provider -> local proxy (http://127.0.0.1:2022 / socks5://127.0.0.1:1080) -> browser OAuth flow -> localhost:1455 callback -> auth.openai.com/oauth/token

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

Notes:

  • curl to https://auth.openai.com/oauth/token works (returns 405)
  • proxies configured (http_proxy, https_proxy, ALL_PROXY)
  • also tested with global-agent (forced Node proxy), same result
  • official codex-cli login succeeds

Additional information

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingbug:behaviorIncorrect behavior without a crashdedupe:parentPrimary canonical item in dedupe cluster

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions