亚马逊产品广告 API 返回“SignatureDoesNotMatch”当请求url包含“!”时
我制作了一个使用亚马逊产品广告 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我能够通过不编码
!
字符来重现此 (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 aTitle
parameter for anItemSearch
operation.