闲社服务运行正常AI智能体自动化平台
g

网关令牌诊断

技能标识:gateway-token-doctor

Diagnose and fix gateway token mismatches causing 401 errors. Align tokens across config, service, and CLI surfaces.

作者:admin | 来源记录:ClawHub
登记来源
ClawHub
版本
V 1.0.0
检测标记
后台标记通过
免费
免费获取
0
收藏
来源与检测标记为平台登记信息,并不代表已展示可复核的检测报告。使用前请核对版本、依赖和所需权限,建议先在隔离环境中运行。
概述
安装方式
版本历史

网关令牌诊断

网关令牌诊断工具

诊断并修复因令牌不匹配导致的401错误。

问题

网关令牌不一致会导致:

  • - 401未授权错误
  • CLI/UI身份验证失败
  • 服务启动失败
  • 静默身份验证降级

工作流程

1. 令牌审计

powershell

检查所有令牌来源


$cfg = Get-Content $HOME/.openclaw/openclaw.json -Raw | ConvertFrom-Json
$auth = $cfg.gateway.auth.token
$remote = $cfg.gateway.remote.token
$service = $env:OPENCLAWGATEWAYTOKEN

auth.token = $auth
remote.token = $remote
service.token = $service

if ($auth -and $remote -and $auth -ne $remote) {
Write-Warning 令牌不匹配:auth != remote
}

2. 对齐修复

powershell

生成或使用现有令牌


$token = $auth

更新配置

$cfg.gateway.auth.token = $token $cfg.gateway.remote.token = $token $cfg | ConvertTo-Json -Depth 10 | Out-File $HOME/.openclaw/openclaw.json -Encoding UTF8

更新服务启动脚本

$servicePath = $HOME/.openclaw/gateway.cmd $content = Get-Content $servicePath -Raw $content = $content -replace OPENCLAWGATEWAYTOKEN=.*, OPENCLAWGATEWAYTOKEN=$token $content | Out-File $servicePath -Encoding UTF8

重启

openclaw gateway restart

3. 验证

powershell

测试网关访问


openclaw gateway status

测试CLI身份验证

openclaw whoami

可执行完成标准

标准验证方式
所有令牌已对齐auth == remote == service
网关响应正常
openclaw gateway status 执行成功 | | CLI身份验证正常 | openclaw whoami 返回用户信息 | | 日志中无401错误 | Select-String 401 logs 无返回结果 |

隐私/安全

  • - 切勿记录实际令牌值
  • 在输出中脱敏令牌(仅显示前4个字符)
  • 令牌仅存储在配置文件中

使用触发条件

以下情况时使用:

  • - 出现401错误
  • 配置更改后重启网关
  • CLI显示身份验证不匹配
  • 服务启动失败



对齐令牌。恢复访问。

标签

skill ai

通过对话安装

以下为平台配置的接入选项,并非逐项实测通过。能否安装取决于客户端支持、技能来源和运行环境:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 gateway-token-doctor-1776287505 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 gateway-token-doctor-1776287505 技能

通过命令行安装

skillhub install gateway-token-doctor-1776287505

下载

⬇ 下载 gateway-token-doctor v1.0.0(免费)

文件大小: 2.01 KB | 发布时间: 2026-4-16 15:33

v1.0.0 最新 2026-4-16 15:33
- Initial release of gateway-token-doctor.
- Diagnose and resolve 401 errors caused by gateway token mismatches.
- Audits token values in config, service, and CLI environments.
- Provides step-by-step Powershell workflow to align and verify token consistency.
- Includes safety guidelines for token handling and redaction.
返回顶部