当我从REST客户端调用API端点时,我通过关注Signature得到了错误.
请求:
主持人:https://xxx.execute-api.ap-southeast-1.amazonaws.com/latest/api/name
授权:AWS4-HMAC-SHA256 Credential =
{AWSKEY}/ 20160314/ap-southeast-1/execute-api/aws4_request,SignedHeaders = host; range; x-amz-date,Signature ={signature}X-Amz-Date:20160314T102915Z
响应:
{
"message": "The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details. The Canonical String for this request should have been 'xxx' "
}
Run Code Online (Sandbox Code Playgroud)
从Java代码开始,我遵循AWS参考如何生成签名.
String secretKey = "{mysecretkey}";
String dateStamp = "20160314";
String regionName = "ap-southeast-1";
String serviceName = …Run Code Online (Sandbox Code Playgroud)