Clawket Gateway QR Code
Generate a QR code that the Clawket mobile app can scan to auto-configure Gateway connection (URL + auth token).
Generate QR Code
Run the script:
CODEBLOCK0
The script will:
- 1. Read
~/.openclaw/openclaw.json for the auth token - Detect the local LAN IP address
- Generate a QR code as a PNG image at INLINECODE1
- Also print an ASCII QR code to the terminal
Send the PNG to the user via the message tool (filePath: ~/.openclaw/media/clawket-qr.png).
QR Payload Format
The QR code contains a JSON object:
CODEBLOCK1
The Clawket app scans this and auto-fills Gateway URL + auth token, then connects.
Troubleshooting
- - If
qrencode is not installed: brew install qrencode (macOS) / sudo apt install qrencode (Linux) / choco install qrencode (Windows) - If the LAN IP detection fails, the script falls back to INLINECODE8
- The token is read directly from the JSON config file (not via
openclaw config get which redacts it)
技能名称:clawket
详细描述:
Clawket 网关二维码
生成一个 Clawket 移动应用可扫描的二维码,用于自动配置网关连接(URL + 认证令牌)。
生成二维码
运行脚本:
bash
bash SKILL_DIR/scripts/gateway-qr.sh
该脚本将:
- 1. 读取 ~/.openclaw/openclaw.json 中的认证令牌
- 检测本地局域网 IP 地址
- 在 ~/.openclaw/media/clawket-qr.png 生成一个 PNG 格式的二维码图片
- 同时在终端打印一个 ASCII 二维码
通过 message 工具将 PNG 图片发送给用户(filePath: ~/.openclaw/media/clawket-qr.png)。
二维码载荷格式
二维码包含一个 JSON 对象:
json
{
host: 192.168.1.100,
port: 18789,
token: ...,
tls: false
}
Clawket 应用扫描此二维码后,会自动填充网关 URL 和认证令牌,然后进行连接。
故障排除
- - 如果未安装 qrencode:brew install qrencode(macOS)/ sudo apt install qrencode(Linux)/ choco install qrencode(Windows)
- 如果局域网 IP 检测失败,脚本将回退到 127.0.0.1
- 令牌直接从 JSON 配置文件中读取(而非通过 openclaw config get 命令,因为该命令会隐藏令牌内容)