unexpected status 401 Unauthorized: 无效的令牌 (request id: 20261001052739301153992c1...
错误信息
unexpected status 401 Unauthorized: 无效的令牌 (request id: 20261001052739301153992c14228f5yZNtXlIl), url: https://www.dmxapi.cn/v1/responses
AI 解决方案
🌐 错误翻译
原文:unexpected status 401 Unauthorized: 无效的令牌 (request id: 20261001052739301153992c14228f5yZNtXlIl), url: https://www.dmxapi.cn/v1/responses
译文:意外状态 401 未授权:无效的令牌,请求地址为 https://www.dmxapi.cn/v1/responses
🎯 原因分析
https://www.dmxapi.cn/v1/responses 发起请求时,身份验证未通过。💡 解决方案
确认您的API密钥正确无误,并按正确格式添加到请求头中:
// 修复后的代码示例
const headers = {
'Authorization': `Bearer ${your_valid_api_token}`,
'Content-Type': 'application/json'
};
const response = await fetch('https://www.dmxapi.cn/v1/responses', {
method: 'POST',
headers,
body: JSON.stringify({ /* 你的请求体 */ })
});