新版 OpenClaw 的 Control UI 不再是“打开网页就能用”,而是引入了三层认证机制:
- Gateway Token(网关认证)
- Device Token(设备认证)
- Pairing(设备授权)
如果缺任何一步,就会出现:
origin not allowedtoken mismatchdevice_token_mismatchpairing required
下面是完整打开流程。
一、启动 OpenClaw(Docker)
确保容器正常运行:
docker ps
看到类似:
openclaw-openclaw-gateway-1 Up (healthy)
说明服务正常。
二、访问 Control UI
浏览器打开:
http://你的服务器IP:18789
或者(你这种情况):
https://openclaw.mydomain.com
如果是通过域名访问,需要额外配置:
允许来源(必须)
docker exec openclaw-openclaw-gateway-1 openclaw config set gateway.controlUi.allowedOrigins '["https://你的域名"]'
三、设置 Gateway Token
如果日志里出现:
(auth=token)
说明已经启用认证。
直接手动设置一个 token(推荐):
docker exec openclaw-openclaw-gateway-1 openclaw config set gateway.auth.token 'abc123456'
docker restart openclaw-openclaw-gateway-1
然后在 Control UI 页面输入:
abc123456
四、处理浏览器设备冲突(重要)
如果出现:
device_token_mismatch
说明浏览器缓存了旧设备信息。
解决:
- 使用无痕模式打开
- 或清除该域名的缓存 / localStorage
五、设备配对(核心步骤)
首次访问一定会出现:
pairing required
此时去容器内查看待批准设备:
docker exec -it openclaw-openclaw-gateway-1 sh
openclaw devices list
你会看到:
Pending (1)
Request: xxxxxxxx
执行批准:
openclaw devices approve <Request ID>
例如:
openclaw devices approve a9cdc750-684c-41b1-b39f-2fc166cc428c
六、完成连接
完成后:
- 页面自动连上
- WebSocket 不再报错
- Control UI 可正常使用
七、常见错误对照表
| 报错 | 原因 | 解决 |
|---|---|---|
| origin not allowed | 域名未加入白名单 | 配置 allowedOrigins |
| token mismatch | token 不一致 | 重新设置 token |
| device_token_mismatch | 浏览器缓存旧设备 | 清缓存 / 无痕 |
| pairing required | 未授权设备 | approve 设备 |
八、本质理解(重点)
新版 OpenClaw Control UI = 三层安全:
浏览器 → Token认证 → 设备认证 → 人工批准 → 网关
不是以前那种“打开就能用”的工具,而是:
👉 一个带设备授权机制的 Agent 控制台
一句话总结
要打开新版 Control UI,必须完成:
允许域名 + 设置 token + 清浏览器状态 + 手动 approve 设备