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(可選擇更新 scope)。

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)scope。
  • devices clear 刻意需要 --yes 才能執行。
  • 如果配對 scope 在本地迴路上不可用(且未傳入明確的 --url),list/approve 可使用本地配對後備。

Token 飄移復原檢查清單

當控制台 UI 或其他用戶端持續出現 AUTH_TOKEN_MISMATCHAUTH_DEVICE_TOKEN_MISMATCH 錯誤時,請使用此檢查清單。

  1. 確認目前的 Gateway token 來源:
openclaw config get gateway.auth.token
  1. 列出已配對的裝置,找出受影響的裝置 id:
openclaw devices list
  1. 為受影響的裝置輪換 operator token:
openclaw devices rotate --device <deviceId> --role operator
  1. 如果輪換不夠,移除過時的配對並重新核准:
openclaw devices remove <deviceId>
openclaw devices list
openclaw devices approve <requestId>
  1. 使用目前的共用 token/密碼重試用戶端連線。

相關資源: