AWS STS - SignatureDoesNotMatch error from HttpWebRequest but exactly the same signature works in Postman and Python

186 Views Asked by At

Due to our system complexity, we chose to follow the hard way of calculating the signature for AWS API instead of using AWS SDK. Below, 3 different ways for sending a request to Amazon STS to assume a role.

  1. First, I used Postman to simulate the request and I got the desired response.
  2. After that, i used the Python script from the AWS Docs to calculate the signature and send the request. It also succeeded.
  3. Finally, using the same Amz-Date and same credentials to calculate the signature through a VB.NET script, i got this SignatureDoesNotMatch error after sending the request ( HttpWebRequest ).

I can see that the calculated signatures in Python Script and .NET are exactly the same if I use a specific datetime! But when I send it from python requests it works, when I send it from .NET HttpWebRequest it fails. Amazon calculates a different signature when I send it from Python and when I send it from .NET .

I guess that some headers are added to my .NET request that Amazon uses and calculates a different signature than mine? Any other idea?

DoesNotMatchSignatureError

0

There are 0 best solutions below