⚠️ Deprecated: codex-auth is no longer maintained as a standalone skill.
Use codex-profiler for all ongoing /codex_auth and /codex_usage operations.
Run scripts/codex_auth.py to generate a login URL and apply callback URL tokens to auth-profiles.json.
Safe defaults
- - Treat callback URLs/tokens as sensitive and never echo full values.
- Use queued apply flow for controlled restart behavior.
- See
RISK.md for allowed/denied operation boundaries.
Commands
- -
/codex_auth → selector (discovered profiles) - INLINECODE7
- INLINECODE8
Interaction adapter
- - If inline buttons are supported: show selector buttons.
- If inline buttons are not supported: send text fallback (
default | <profile>). - Callback message handling must never echo full callback URLs (treat as sensitive).
- Use callback_data namespace prefix
codex_auth_* to avoid collisions.
How to run
Start flow:
CODEBLOCK0
Finish flow (after browser redirect URL is pasted):
CODEBLOCK1
Queue safe apply (stops/restarts gateway in background):
CODEBLOCK2
Safety posture
- - No remote shell execution (
curl|bash, wget|sh) is allowed by this skill. - No
sudo/SSH/system package mutation is performed by this skill. - OAuth callback URLs are sensitive: never echo full callback URLs or tokens in chat output.
- Writes are limited to auth profile state files with lock-based coordination.
Notes
- - Uses the same OpenAI Codex OAuth constants/method as OpenClaw onboarding (
auth.openai.com + localhost callback). - OAuth success here does not guarantee
chatgpt.com/backend-api/wham/usage acceptance; usage endpoint may reject token/session format with 401 and should be handled by usage/profiler skills. - Endpoint trust boundary: OpenAI auth hosts + localhost callback flow only; do not send callbacks/tokens to third-party hosts.
- Writes
~/.openclaw/agents/main/agent/auth-profiles.json with file locking to reduce race risk while gateway is running. - Profile IDs map as:
-
default ->
openai-codex:default (or first discovered codex profile if default missing)
- any other selector ->
openai-codex:<selector>
- - Pending auth state is stored in
/tmp/openclaw/codex-auth-pending.json.
⚠️ 已弃用: codex-auth 不再作为独立技能维护。
所有持续的 /codexauth 和 /codexusage 操作请使用 codex-profiler。
运行 scripts/codex_auth.py 生成登录 URL,并将回调 URL 令牌应用到 auth-profiles.json。
安全默认值
- - 将回调 URL/令牌视为敏感信息,切勿回显完整值。
- 使用队列化应用流程以实现受控重启行为。
- 允许/禁止的操作边界请参见 RISK.md。
命令
- - /codexauth → 选择器(已发现的配置文件)
- /codexauth
- /codexauth finish url>
交互适配器
- - 如果支持内联按钮:显示选择器按钮。
- 如果不支持内联按钮:发送文本回退方案(default | )。
- 回调消息处理绝不能回显完整的回调 URL(视为敏感信息)。
- 使用回调数据命名空间前缀 codexauth* 以避免冲突。
运行方法
启动流程:
bash
python3 skills/codex-auth/scripts/codex_auth.py start --profile default
完成流程(粘贴浏览器重定向 URL 后):
bash
python3 skills/codex-auth/scripts/codex_auth.py finish --profile default --callback-url http://localhost:1455/auth/callback?code=...&state=...
队列安全应用(在后台停止/重启网关):
bash
python3 skills/codex-auth/scripts/codex_auth.py finish --profile default --callback-url http://localhost:1455/auth/callback?code=...&state=... --queue-apply
python3 skills/codex-auth/scripts/codex_auth.py status
安全策略
- - 本技能不允许远程 shell 执行(curl|bash、wget|sh)。
- 本技能不执行 sudo/SSH/系统包变更操作。
- OAuth 回调 URL 属于敏感信息:切勿在聊天输出中回显完整回调 URL 或令牌。
- 写入操作仅限于基于锁协调的身份配置文件状态文件。
注意事项
- - 使用与 OpenClaw 入门相同的 OpenAI Codex OAuth 常量/方法(auth.openai.com + localhost 回调)。
- 此处 OAuth 成功不保证 chatgpt.com/backend-api/wham/usage 接受;使用端点可能以 401 拒绝令牌/会话格式,应由使用/分析技能处理。
- 端点信任边界:仅限 OpenAI 认证主机 + localhost 回调流程;请勿将回调/令牌发送至第三方主机。
- 使用文件锁定写入 ~/.openclaw/agents/main/agent/auth-profiles.json,以在网关运行时降低竞态风险。
- 配置文件 ID 映射如下:
- default -> openai-codex:default(若 default 缺失则使用第一个发现的 codex 配置文件)
- 其他选择器 -> openai-codex:
- - 待处理认证状态存储于 /tmp/openclaw/codex-auth-pending.json。