跳到內容

使用 OpenClaw QR 指令:快速產生 iOS 配對碼與設定

每次要幫 iOS 裝置配對 Gateway 的時候,最煩的就是手動輸入那一長串的 URL 跟 Token。如果能直接掃個碼就搞定,開發體驗真的會好很多。

openclaw qr 就是為了這個目的設計的,讓你從目前的 Gateway 設定中直接產生配對用的 QR Code 和 Setup Code,省去手動輸入的麻煩。

Generate an iOS pairing QR and setup code from your current Gateway configuration.

Terminal window
openclaw qr
openclaw qr --setup-code-only
openclaw qr --json
openclaw qr --remote
openclaw qr --url wss://gateway.example/ws --token '<token>'
  • --remote: 使用 gateway.remote.url 加上設定檔中的遠端 token/password
  • --url <url>: 覆寫 payload 中使用的 Gateway URL
  • --public-url <url>: 覆寫 payload 中使用的公開 URL
  • --token <token>: 覆寫 payload 的 Gateway token
  • --password <password>: 覆寫 payload 的 Gateway password
  • --setup-code-only: 只印出 setup code
  • --no-ascii: 跳過 ASCII QR 渲染
  • --json: 輸出 JSON (setupCode, gatewayUrl, auth, urlSource)
  • --token 和 --password 是互斥的,不能同時使用。
  • 使用 --remote 時,如果有效的遠端憑證被設定為 SecretRefs 且你沒有傳入 --token 或 --password,指令會從當前的 Gateway 快照中解析它們。如果 Gateway 無法連線,指令會直接報錯。
  • 不使用 --remote 時,若未傳入 CLI 認證覆寫,則會解析本地 Gateway 的 auth SecretRefs:
    • 當 token 認證優先時(明確設定 gateway.auth.mode="token" 或在沒有 password 來源的情況下推論出的模式),會解析 gateway.auth.token。
    • 當 password 認證優先時(明確設定 gateway.auth.mode="password" 或在 auth/env 中沒有 token 來源的情況下推論出的模式),會解析 gateway.auth.password。
  • 如果同時設定了 gateway.auth.token 和 gateway.auth.password(包含 SecretRefs)且未設定 gateway.auth.mode,則 setup-code 解析會失敗,直到你明確設定模式為止。
  • Gateway 版本相容性:此指令路徑需要支援 secrets.resolve 的 Gateway;舊版 Gateway 會回傳 unknown-method 錯誤。
  • 掃描後,請使用以下指令核准裝置配對:
    • openclaw devices list
    • openclaw devices approve <requestId>

想要更自動化的設定流程嗎?試試我們的 AI Setup Assistant。

OpenClaw

OpenClaw Expert

還是卡住了?

如果這篇文件沒有解決你的情境,直接問 OpenClaw Expert,拿到可執行步驟。