亚马逊产品广告 API 返回“SignatureDoesNotMatch”当请求url包含“!”时

发布于 2024-12-19 19:32:13 字数 1518 浏览 2 评论 0原文

我制作了一个使用亚马逊产品广告 API 的 VBA 程序。通常它工作得很好,但是当请求 url 包含 !( 时,API 返回错误代码 SignatureDoesNotMatch。但是,签名和 URL 我的程序发送与 http://associates-amazon.s3.amazonaws.com/signed-requests/helper/index.html 生成(因此生成的 url 也会出现错误)

(, ), *, !

@ / [ ] { } + - = , : ; # $ % & ^ ~ ` 不。(似乎它们被忽略了。)

从参数中删除这些字符是一个解决方案,但如果有人知道问题的原因和/或更好的解决方案,请告诉我。 .

程序在这里。 入口点是“main.searchBookInfo”和“助手.getSignature”生成签名

示例:

未签名的 URL:

http://ecs.amazonaws.jp/onca/xml?AWSAccessKeyId=AKIAIL7NZCKP32A32LQQ&AssociateTag=attentiveada-20&Author=&Operation=ItemSearch&Publisher=&ResponseGroup=ItemAttributes&SearchIndex=Books&Service=AWSECommerceService&Timestamp=2011-12-03T20%3A26%3A16%2B0900&Title=!&Version=2011-08-01

要签名的字符串:

GET
ecs.amazonaws.jp
/onca/xml
AWSAccessKeyId=AKIAIL7NZCKP32A32LQQ&AssociateTag=attentiveada-20&Author=&Operation=ItemSearch&Publisher=&ResponseGroup=ItemAttributes&SearchIndex=Books&Service=AWSECommerceService&Timestamp=2011-12-03T20%3A26%3A16%2B0900&Title=!&Version=2011-08-01

签名:

fmQKEfrtYkdWoJNHUryWIPoybM%2FqzOdFFmlgrQkBS2E%3D

I made a VBA program that uses Amazon Product Advertising API. Usually it works well, but when the request url contains ! or ( the API returns error code SignatureDoesNotMatch. But, the signature and URL my program sends is completely the same with the one http://associates-amazon.s3.amazonaws.com/signed-requests/helper/index.html generates (so the generated url also gets the error).

The error is caused by (, ), *, ! and '.

@ / [ ] { } + - = . , : ; \ | _ ? " # $ % & ^ ~ ` don't. (Seemingly they're simply ignored.)

Removing those characters from parameters is a solution. But if anyone knows the cause of the problem and/or better solution, please let me know.

The program is here. The entry point is "main.searchBookInfo" and "helper.getSignature" generates signature.

Example:

Unsigned URL:

http://ecs.amazonaws.jp/onca/xml?AWSAccessKeyId=AKIAIL7NZCKP32A32LQQ&AssociateTag=attentiveada-20&Author=&Operation=ItemSearch&Publisher=&ResponseGroup=ItemAttributes&SearchIndex=Books&Service=AWSECommerceService&Timestamp=2011-12-03T20%3A26%3A16%2B0900&Title=!&Version=2011-08-01

String to sign:

GET
ecs.amazonaws.jp
/onca/xml
AWSAccessKeyId=AKIAIL7NZCKP32A32LQQ&AssociateTag=attentiveada-20&Author=&Operation=ItemSearch&Publisher=&ResponseGroup=ItemAttributes&SearchIndex=Books&Service=AWSECommerceService&Timestamp=2011-12-03T20%3A26%3A16%2B0900&Title=!&Version=2011-08-01

Signature:

fmQKEfrtYkdWoJNHUryWIPoybM%2FqzOdFFmlgrQkBS2E%3D

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

天冷不及心凉 2024-12-26 19:32:13

我能够通过编码 ! 字符来重现此 (SignatureDoesNotMatch)。因此,我假设如果您在签名之前对 ! 字符进行编码,那么这将起作用。尽管我没有测试其他角色,但情况可能也是如此。

仅供参考,当我使用 ! 作为 ItemSearch 操作的 Title 参数时,我确实得到了结果。

I was able to reproduce this (SignatureDoesNotMatch) by not encoding the ! character. So I'm going to assume that if you encode the ! character before you sign then this will work. The same is probably true of the other characters although I didn't test them.

Just FYI, I did get results back when using ! as a Title parameter for an ItemSearch operation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文