TreeMap<String, String> awsHeaders = new TreeMap<String, String>();
awsHeaders.put("host", "***-ats.iot.us-east-1.amazonaws.com");
TreeMap<String, String> awsQueryParam = new TreeMap<>();
awsQueryParam.put("qos", "0");
AWSV4Auth aWSV4Auth = new AWSV4Auth.Builder(accessKey, secretKey)
.regionName("us-east-1")
.serviceName("iotdata") // es - elastic search. use your service name
.httpMethodName("POST") //GET, PUT, POST, DELETE, etc...
.canonicalURI("topics/test") //end point
.queryParametes(awsQueryParam) //query parameters if any
.awsHeaders(awsHeaders) //aws header parameters
.payload(payload) // payload if any
.debug() // turn on the debug mode
.build();
but getting signature error
Client error <403 FORBIDDEN Forbidden,{"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.","traceId":"80e40ad7-9db1-7a60-809a-889c9fecb852"},[date:"Mon, 11 Feb 2019 20:57:32 GMT", x-amzn-ErrorType:"ForbiddenException:", x-amzn-RequestId:"80e40ad7-9db1-7a60-809a-889c9fecb852", connection:"keep-alive", content-type:"application/json", content-length:"241"]>
Hello,
i am having trouble with signature of aws canonical request, using your util i am trying to make a post call for the iot endpoint https://**-ats.iot.us-east-1.amazonaws.com/topics/test?qos=0 same req was working with postman client
but getting signature error
Client error <403 FORBIDDEN Forbidden,{"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.","traceId":"80e40ad7-9db1-7a60-809a-889c9fecb852"},[date:"Mon, 11 Feb 2019 20:57:32 GMT", x-amzn-ErrorType:"ForbiddenException:", x-amzn-RequestId:"80e40ad7-9db1-7a60-809a-889c9fecb852", connection:"keep-alive", content-type:"application/json", content-length:"241"]>
let me know if i am doing anything wrong
Thank you,