openclaw qr

根据当前 Gateway 配置生成 iOS 配对二维码和设置码。

用法

openclaw qr
openclaw qr --setup-code-only
openclaw qr --json
openclaw qr --remote
openclaw qr --url wss://gateway.example/ws

参数

  • --remote:使用 gateway.remote.url 以及配置中的远程 token / password
  • --url <url>:覆盖负载中使用的 gateway URL
  • --public-url <url>:覆盖负载中使用的公共 URL
  • --token <token>:覆盖引导流程中认证所用的 gateway token
  • --password <password>:覆盖引导流程中认证所用的 gateway password
  • --setup-code-only:只输出设置码
  • --no-ascii:跳过 ASCII 二维码渲染
  • --json:输出 JSON 格式(setupCodegatewayUrlauthurlSource

注意事项

  • --token--password 互斥。
  • 设置码本身现在携带一个短时效的不透明 bootstrapToken,而非共享的 gateway token / password。
  • 使用 --remote 时,如果当前激活的远程凭据配置为 SecretRef 且没有传 --token--password,命令会从当前 gateway 快照中解析。如果 gateway 不可用,命令直接失败。
  • 不使用 --remote 时,如果没有传 CLI 认证覆盖参数,本地 gateway 认证的 SecretRef 会被解析:
    • gateway.auth.token 在 token 认证可能生效时解析(显式设置 gateway.auth.mode="token" 或推断模式中没有 password 源胜出时)。
    • gateway.auth.password 在 password 认证可能生效时解析(显式设置 gateway.auth.mode="password" 或推断模式中没有来自 auth / env 的 token 胜出时)。
  • 如果同时配置了 gateway.auth.tokengateway.auth.password(包括 SecretRef)且 gateway.auth.mode 未设置,设置码解析会失败,直到显式设置 mode。
  • Gateway 版本兼容提示:此命令路径要求 gateway 支持 secrets.resolve;旧版 gateway 会返回 unknown-method 错误。
  • 扫码后,通过以下命令审批设备配对:
    • openclaw devices list
    • openclaw devices approve <requestId>