I'm working on some code to generate headers using the AWS Signature V4 signing process. I have been able to get the GET requests to work correctly. But when I do POST with form data (Content-Type=application/x-www-form-urlencoded), I always get this error:
"The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method..."
After some investigation, I'm pretty sure that this is caused by how AWS calculates the "payload_hash" (hash of the request body content). But I can't find anywhere how it is calculated for a POST request with form data. (This sampel here only shows the empty palyload: https://docs.aws.amazon.com/general/latest/gr/sigv4-signed-request-examples.html). BTW, I also tried this with Postman using its AWS Signature Auth method and Postman gave me the same error!
Any clue on how to troubleshoot this issue?