快速开始
二维码
openclaw qr
根据你当前的 Gateway 网关配置生成移动端配对 QR 和设置代码。
用法
openclaw qr
openclaw qr --setup-code-only
openclaw qr --json
openclaw qr --remote
openclaw qr --url wss://gateway.example/ws
选项
--remote:优先使用gateway.remote.url;如果未设置,gateway.tailscale.mode=serve|funnel仍可提供远程公开 URL--url <url>:覆盖 payload 中使用的 Gateway 网关 URL--public-url <url>:覆盖 payload 中使用的公开 URL--token <token>:覆盖 bootstrap 流程用于认证的 Gateway 网关 token--password <password>:覆盖 bootstrap 流程用于认证的 Gateway 网关密码--setup-code-only:只打印设置代码--no-ascii:跳过 ASCII QR 渲染--json:输出 JSON(setupCode、gatewayUrl、auth、urlSource)
注意事项
--token和--password互斥。- 设置代码本身现在携带一个不透明、短期有效的
bootstrapToken,而不是共享的 Gateway 网关 token/密码。 - 在内置的节点/operator bootstrap 流程中,主节点 token 仍会以
scopes: []写入。 - 如果 bootstrap 交接还签发了 operator token,它会保持限定在 bootstrap allowlist 内:
operator.approvals、operator.read、operator.talk.secrets、operator.write。 - Bootstrap scope 检查带有角色前缀。该 operator allowlist 只满足 operator 请求;非 operator 角色仍需要在其自身角色前缀下的 scope。
- 对于 Tailscale/公开
ws://Gateway 网关 URL,移动端配对会默认失败并关闭。私有 LAN 地址和.localBonjour 主机仍支持通过ws://使用,但 Tailscale/公开移动端路由应使用 Tailscale Serve/Funnel 或wss://Gateway 网关 URL。 - 使用
--remote时,OpenClaw 需要gateway.remote.url或gateway.tailscale.mode=serve|funnel。 - 使用
--remote时,如果实际处于活动状态的远程凭证配置为 SecretRefs,并且你没有传入--token或--password,该命令会从活动 Gateway 网关快照中解析它们。如果 Gateway 网关不可用,该命令会快速失败。 - 不使用
--remote时,如果没有传入 CLI 认证覆盖项,则会解析本地 Gateway 网关认证 SecretRefs:- 当 token 认证可以胜出时,解析
gateway.auth.token(显式gateway.auth.mode="token",或在没有密码来源胜出的情况下推断出的模式)。 - 当密码认证可以胜出时,解析
gateway.auth.password(显式gateway.auth.mode="password",或在没有来自 auth/env 的 token 胜出时推断出的模式)。
- 当 token 认证可以胜出时,解析
- 如果同时配置了
gateway.auth.token和gateway.auth.password(包括 SecretRefs),且未设置gateway.auth.mode,设置代码解析会失败,直到显式设置模式。 - Gateway 网关版本偏差注意事项:此命令路径需要支持
secrets.resolve的 Gateway 网关;较旧的 Gateway 网关会返回未知方法错误。 - 扫描后,使用以下命令批准设备配对:
openclaw devices listopenclaw devices approve <requestId>