跳转到内容

devices

管理设备配对请求和设备作用域令牌。

列出待处理的配对请求和已配对的设备。

openclaw devices list
openclaw devices list --json

待处理请求的输出包括请求的角色和作用域,以便在您批准之前审查批准。

移除一个已配对的设备条目。

openclaw devices remove <deviceId>
openclaw devices remove <deviceId> --json

批量清除已配对的设备。

openclaw devices clear --yes
openclaw devices clear --yes --pending
openclaw devices clear --yes --pending --json

openclaw devices approve [requestId] [--latest]

Section titled “openclaw devices approve [requestId] [--latest]”

批准待处理的设备配对请求。如果省略了 requestId,OpenClaw 将自动批准最近的待处理请求。

注意:如果设备使用更改的身份验证详细信息(角色/作用域/公钥)重试配对,OpenClaw 将取代先前的待处理条目并颁发一个新的 requestId。请在批准之前运行 openclaw devices list 以使用当前 ID。

openclaw devices approve
openclaw devices approve <requestId>
openclaw devices approve --latest

拒绝待处理的设备配对请求。

openclaw devices reject <requestId>

openclaw devices rotate --device <id> --role <role> [--scope <scope...>]

Section titled “openclaw devices rotate --device <id> --role <role> [--scope <scope...>]”

轮换特定角色的设备令牌(可选择更新作用域)。

openclaw devices rotate --device <deviceId> --role operator --scope operator.read --scope operator.write

openclaw devices revoke --device <id> --role <role>

Section titled “openclaw devices revoke --device <id> --role <role>”

撤销特定角色的设备令牌。

openclaw devices revoke --device <deviceId> --role node
  • --url <url>:Gateway(网关) WebSocket URL(配置时默认为 gateway.remote.url)。
  • --token <token>:Gateway(网关) 令牌(如果需要)。
  • --password <password>:Gateway(网关) 密码(密码身份验证)。
  • --timeout <ms>:RPC 超时。
  • --json:JSON 输出(建议用于脚本编写)。

注意:当您设置 --url 时,CLI 不会回退到配置或环境凭据。显式传递 --token--password。缺少显式凭据将报错。

  • 令牌轮换返回一个新令牌(敏感)。请将其视为机密。
  • 这些命令需要 operator.pairing(或 operator.admin)作用域。
  • devices clear--yes 的有意限制。
  • 如果在 local loopback 上无法使用配对作用域(且未传递显式 --url),列表/批准可以使用本地配对回退。

当控制 UI 或其他客户端持续因 AUTH_TOKEN_MISMATCHAUTH_DEVICE_TOKEN_MISMATCH 失败时,请使用此方法。

  1. 确认当前的网关令牌来源:
Terminal window
openclaw config get gateway.auth.token
  1. 列出已配对的设备并识别受影响的设备 ID:
Terminal window
openclaw devices list
  1. 轮换受影响设备的操作员令牌:
Terminal window
openclaw devices rotate --device <deviceId> --role operator
  1. 如果轮换不够,请移除过时的配对并再次批准:
Terminal window
openclaw devices remove <deviceId>
openclaw devices list
openclaw devices approve <requestId>
  1. 使用当前的共享令牌/密码重试客户端连接。

相关: