openclaw devices
管理设备配对请求和设备级别的 token。
命令
openclaw devices list
列出待处理的配对请求和已配对的设备。
openclaw devices list
openclaw devices list --json
openclaw devices remove <deviceId>
移除一个已配对的设备条目。
openclaw devices remove <deviceId>
openclaw devices remove <deviceId> --json
openclaw devices clear --yes [--pending]
批量清除已配对的设备。
openclaw devices clear --yes
openclaw devices clear --yes --pending
openclaw devices clear --yes --pending --json
openclaw devices approve [requestId] [--latest]
批准一个待处理的设备配对请求。如果省略 requestId,OpenClaw 会自动批准最近的待处理请求。
openclaw devices approve
openclaw devices approve <requestId>
openclaw devices approve --latest
openclaw devices reject <requestId>
拒绝一个待处理的设备配对请求。
openclaw devices reject <requestId>
openclaw devices rotate --device <id> --role <role> [--scope <scope...>]
为特定角色轮换设备 token(可选更新作用域)。
openclaw devices rotate --device <deviceId> --role operator --scope operator.read --scope operator.write
openclaw devices revoke --device <id> --role <role>
撤销特定角色的设备 token。
openclaw devices revoke --device <deviceId> --role node
通用选项
--url <url>:Gateway WebSocket URL(配置了gateway.remote.url时使用默认值)。--token <token>:Gateway token(如需要)。--password <password>:Gateway 密码(密码认证)。--timeout <ms>:RPC 超时。--json:JSON 输出(推荐用于脚本)。
注意:设置 --url 时,CLI 不会回退到配置或环境凭据。需要显式传入 --token 或 --password,缺少显式凭据会报错。
注意事项
- Token 轮换会返回新 token(敏感信息),请按密钥标准处理。
- 这些命令需要
operator.pairing(或operator.admin)权限。 devices clear需要--yes才能执行,这是有意为之。- 如果本地回环上配对权限不可用(且没有显式传入
--url),list/approve 可以使用本地配对回退。
Token 漂移恢复清单
当控制面板或其他客户端持续出现 AUTH_TOKEN_MISMATCH 或 AUTH_DEVICE_TOKEN_MISMATCH 错误时,按以下步骤排查。
- 确认当前 Gateway token 来源:
openclaw config get gateway.auth.token
- 列出已配对设备,找到受影响的设备 ID:
openclaw devices list
- 为受影响的设备轮换 operator token:
openclaw devices rotate --device <deviceId> --role operator
- 如果轮换不够,移除过期的配对并重新批准:
openclaw devices remove <deviceId>
openclaw devices list
openclaw devices approve <requestId>
- 用当前共享的 token/密码重试客户端连接。
相关文档: