AWS STS- httpwebrequest的SignaturedoesnotMatch错误,但在Postman和Python中完全相同的签名作品
由于我们的系统复杂性,我们选择遵循计算AWS API签名的艰难方式,而不是使用AWS SDK。下面,向亚马逊STS发送请求以担任角色的3种不同方法。
- 首先,我使用Postman模拟了请求,并得到了所需的响应。
- 之后,我使用了AWS文档中的Python脚本来计算签名并发送请求。它也成功了。
- 最后,使用相同的AMZ日期和相同的凭证通过VB.NET脚本计算签名,在发送请求后,我遇到了此signaturedoesnotmatch错误(httpwebrequest)。
我可以看到,如果我使用特定的dateTime,则Python脚本和.NET中计算出的签名完全相同!但是,当我从Python请求发送它时,它可以正常运行时,当我从.NET httpwebrequest发送它时,它会失败。当我从Python发送并从.NET发送时,Amazon会计算不同的签名。
我猜想,某些标题被添加到我的.NET请求中,亚马逊使用并计算了与我的签名不同的签名?还有其他想法吗?
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.
- First, I used Postman to simulate the request and I got the desired response.
- After that, i used the Python script from the AWS Docs to calculate the signature and send the request. It also succeeded.
- 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论