Skip to content

openclaw qr

从当前 Gateway 配置生成 iOS 配对二维码和 Setup Code。

用法

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

选项

  • --remote:使用 gateway.remote.url 加上配置中的远程令牌/密码
  • --url <url>:覆盖 payload 中使用的 Gateway URL
  • --public-url <url>:覆盖 payload 中使用的公共 URL
  • --token <token>:覆盖 bootstrap 流程鉴权使用的 Gateway 令牌
  • --password <password>:覆盖 bootstrap 流程鉴权使用的 Gateway 密码
  • --setup-code-only:仅打印 Setup Code
  • --no-ascii:跳过 ASCII 二维码渲染
  • --json:输出 JSON(包含 setupCodegatewayUrlauthurlSource

说明

  • --token--password 互斥。
  • Setup Code 现在携带不透明的短期 bootstrapToken,而非共享的 Gateway 令牌/密码。
  • 使用 --remote 时,如果远程凭证配置为 SecretRef 且未传入 --token--password,命令会从活跃 Gateway 快照中解析凭证;若 Gateway 不可用,命令立即报错退出。
  • 不使用 --remote 时,当没有传入 CLI 认证覆盖参数时会解析本地 Gateway 的 auth SecretRef:
    • 当令牌认证能够生效时(显式设置 gateway.auth.mode="token" 或推断模式下无密码来源获胜),gateway.auth.token 会被解析。
    • 当密码认证能够生效时(显式设置 gateway.auth.mode="password" 或推断模式下无获胜令牌),gateway.auth.password 会被解析。
  • 如果同时配置了 gateway.auth.tokengateway.auth.password(包括 SecretRef)且未设置 gateway.auth.mode,Setup Code 解析将失败,直到显式设置 mode 为止。
  • Gateway 版本差异说明:此命令路径需要支持 secrets.resolve 的 Gateway;旧版 Gateway 会返回未知方法错误。
  • 扫码后,使用以下命令审批设备配对:
    • openclaw devices list
    • openclaw devices approve <requestId>

Tipsopenclaw qr 是连接 iOS 客户端最快的方式,扫一扫就能把你的小龙虾绑定到手机上,随时随地发号施令。