Why is my implementation of AwsSignatureVersion4 responding with a Forbidden status

73 Views Asked by At

I am making use of the .Net AwsSignatureVersion4 package to facilitate the signing of the AWS request.

Part of the process is to first assume an IAM role, and use the credentials received from the AWS.SDK STS service (AccessKeyId, SecretAccessKey and SessionToken) as parameters to the overloaded HttpClient.PostAsync method. I am however unable to get a successful response, all the requests responds with Forbidden.

The steps I follow to perform the request are as follows:

  1. Assume Role via AWS.SDK
  2. Use the credentials retrieved from step 1 as input parameters to HttpClient.PostAsync.

In addition to the credentials parameter, an endpoint, a null instance of HttpContent (because there is no post body), aws region and -service name are provided:

HttpClient.PostAsync("api gateway endpoint", null, "aws region", "execute-api", credentials)

Performing these steps and executing the Post responds with a Forbidden status.

Any guidance on where I might be going wrong please?

0

There are 0 best solutions below