你瞅啥呢

2025-11-22 "error": {"status": 401,"type": "https://dev.qweather.com/docs/resource/error-code/#unauthorized","title": "Unauthorized","detail": "Authentication failed, check your KE

请求详情:

Method: GET
URL: 你的api host/v7/weather/now
Full URL: 你的api host//v7/weather/now?location=101010100&lang=zh
Parameters: { location: '101010100', lang: 'zh' }
Headers: {
Authorization: 'Bearer eyJhbGciOiJFZERTQSIsImtpZCI6IkM1QjhVMjJUREoiLCJ0eX...',
'Accept-Encoding': 'gzip',
'User-Agent': 'axios/1.13.2'
}

返回:

状态码: 401
状态文本:
响应头: {
"date": "Sat, 22 Nov 2025 07:50:06 GMT",
"content-type": "application/problem+json",
"content-length": "160",
"connection": "keep-alive",
"access-control-allow-origin": "*",
"access-control-allow-methods": "*",
"access-control-allow-headers": "*"
}
响应数据: {
"error": {
"status": 401,
"type": "https://dev.qweather.com/docs/resource/error-code/#unauthorized",
"title": "Unauthorized",
"detail": "Authentication failed, check your KEY/Token or Host."
}
}

问题说明:我正在调用和风天气的api,调的接口是:你的api host/v7/weather/now

返回401,提示未授权,原因:jwt token已过期

怎么发现的呢?我把生成的jwt token复制到和风天气的控制台的

帮助与支持

的jwt验证

image

 重新生成token,也可以把token重新扔到这里来验证

image

这样就不会报401了

注意:如果你是把项目、凭据、公私钥全删了重新配置时,需要等待n分钟配置才能生效。这是个大坑!!!!!!!!!!

posted @ 2025-11-22 16:24  叶乘风  阅读(15)  评论(0)    收藏  举报