本文导读
链接复制成功!
IAM认证信息错误
IAM认证信息错误有:
- Incorrect IAM authentication information: verify aksk signature fail
- Incorrect IAM authentication information: AK access failed to reach the limit, forbidden
- Incorrect IAM authentication information: decrypt token fail
- Incorrect IAM authentication information: Get secretKey failed
Incorrect IAM authentication information: verify aksk signature fail
{
"error_msg": "Incorrect IAM authentication information: verify aksk signature fail, ......
"error_code": "APIGW.0301",
"request_id": "******"
}
可能原因
签名认证算法使用有问题,客户端计算的签名结果与API网关计算的签名结果不同。
解决方法
- 下载js版本,查看可视化签名SDK,获取签名字符串。
- 解压压缩包,使用浏览器打开“demo.html”文件。
- 获取x-sdk-date值,x-sdk-date值必须与当前时间相差在15min以内。
- 在键盘中按下“F12”,并在页面中选择“Sources > Snippets > New snippet”。
- 将以下代码复制到右侧的Script snippet中,然后在左侧右键Script snippet名称,选择“Run”后,“Console”中打印的值就是x-sdk-date值。
function twoChar(s) { if (s >= 10) { return "" + s } else { return "0" + s } } function getTime() { var date = new Date(); return "" + date.getUTCFullYear() + twoChar(date.getUTCMonth() + 1) + twoChar(date.getUTCDate()) + "T" + twoChar(date.getUTCHours()) + twoChar(date.getUTCMinutes()) + twoChar(date.getUTCSeconds()) + "Z" } getTime()
- 将x-sdk-date添加到Headers中,并填写其余参数,单击“debug”获取签名字符串。
非get\delete\head请求,需要携带body体,需要在上图Body框中添加body(格式与发送请求的body一致)。
- 比较本地代码中签名结果与js可视化签名结果。
例如排查java语言签名代码中的canonicalRequest、stringToSign、authorizationHeader值,与js可视化签名字符串是否一致。
Incorrect IAM authentication information: AK access failed to reach the limit, forbidden
{
"error_msg": "Incorrect IAM authentication information: AK access failed to reach the limit,forbidden." ......
"error_code": "APIGW.0301",
"request_id": "******"
}
可能原因
- aksk签名计算错误。
- ak对应的sk不匹配。
- aksk频繁出现鉴权出错,连续错误5次以上,被锁定5分钟(5分钟内鉴权失败,误以为是异常的鉴权请求)。
解决方法
- 请参考Incorrect IAM authentication information: verify aksk signature fail解决方法。
- 请检查使用的sk是否正确。
- 请在5分钟之后重试。
父主题: 常见问题