# Amazon Product API hmac signature?

**URL:** <https://www.ruby-forum.com/t/amazon-product-api-hmac-signature/167650>\
**Category:** Ruby\
**Created:** [May 11, 2009, 3:54am UTC](https://www.ruby-forum.com/t/amazon-product-api-hmac-signature/167650 "2009-05-11T03:54:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrochkind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@jrochkind](https://www.ruby-forum.com/u/jrochkind)\
**Post date:** [May 11, 2009, 3:54am UTC](https://www.ruby-forum.com/t/amazon-product-api-hmac-signature/167650/1 "2009-05-11T03:54:18Z")

</div>

So, starting August 15th, the Amazon product web service API (the one  
where you can get info about amazon products, manipulate wishlists and  
shopping carts, etc), is going to require a form of cryptographic  
signature on all requests.

[http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/](http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/)

I think I can put everything together from various gems. But it’s kind  
of picky (for instance, you have to make sure to CGI-escape in exactly  
the right way and not over-escape at certain points).

I’m wondering if anyone knows if anyone’s already tackled this, and  
maybe has a gem with tests that’ll do it for you? Maybe part of some  
larger amazon-interaction gem or something? This authentication method  
has been used with other AWS apis for a while now I think. But I can’t  
find anything.

If not, and I write it, do you all think it would be a good thing to  
distribute as a gem? It probably won’t be very many lines of code, but  
making sure you’ve got the _right_ few lines of code that don’t have any  
bugs in them is the trick.

Thanks for any advice,  
Jonathan

---

<div class="post-metadata">

**Author:** ![jrochkind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@jrochkind](https://www.ruby-forum.com/u/jrochkind)\
**Post date:** [May 11, 2009, 4:18am UTC](https://www.ruby-forum.com/t/amazon-product-api-hmac-signature/167650/2 "2009-05-11T04:18:41Z")

</div>

On Sun, May 10, 2009 at 6:54 PM, Jonathan R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> I’m wondering if anyone knows if anyone’s already tackled this, and  
> maybe has a gem with tests that’ll do it for you? Maybe part of some  
> larger amazon-interaction gem or something? This authentication method  
> has been used with other AWS apis for a while now I think. But I can’t  
> find anything.

Both RightAWS and AWS::S3 have code to sign requests. I’d start there.

Ben

---

<div class="post-metadata">

**Author:** ![jrochkind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@jrochkind](https://www.ruby-forum.com/u/jrochkind)\
**Post date:** [August 10, 2009, 10:54am UTC](https://www.ruby-forum.com/t/amazon-product-api-hmac-signature/167650/3 "2009-08-10T10:54:46Z")

</div>

Hi Jonathan,

Have you found some solution to this issue? I am using ruby/aws and I  
have received that my requests are not signed. I would appreciate any  
help to solve this problem.

Thank you.

Jonathan R. wrote:

> So, starting August 15th, the Amazon product web service API (the one  
> where you can get info about amazon products, manipulate wishlists and  
> shopping carts, etc), is going to require a form of cryptographic  
> signature on all requests.
> 
> [http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/](http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/)
> 
> I think I can put everything together from various gems. But it’s kind  
> of picky (for instance, you have to make sure to CGI-escape in exactly  
> the right way and not over-escape at certain points).
> 
> I’m wondering if anyone knows if anyone’s already tackled this, and  
> maybe has a gem with tests that’ll do it for you? Maybe part of some  
> larger amazon-interaction gem or something? This authentication method  
> has been used with other AWS apis for a while now I think. But I can’t  
> find anything.
> 
> If not, and I write it, do you all think it would be a good thing to  
> distribute as a gem? It probably won’t be very many lines of code, but  
> making sure you’ve got the _right_ few lines of code that don’t have any  
> bugs in them is the trick.
> 
> Thanks for any advice,  
> Jonathan

---

<div class="post-metadata">

**Author:** ![jrochkind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@jrochkind](https://www.ruby-forum.com/u/jrochkind)\
**Post date:** [September 1, 2009, 4:17pm UTC](https://www.ruby-forum.com/t/amazon-product-api-hmac-signature/167650/4 "2009-09-01T16:17:33Z")

</div>

CÃ©sar DÃ­az wrote:

> Hi Jonathan,
> 
> Have you found some solution to this issue? [signing Amazon Product API requests].  
> I am using ruby/aws and I  
> have received that my requests are not signed. I would appreciate any  
> help to solve this problem.

Yes, I found and adapted some code from Chris R… See my version here:

> **[Authenticating to Amazon Product API in ruby](https://bibwild.wordpress.com/2009/05/18/authenticating-to-amazon-product-api-in-ruby/)**
>
> So, the Amazon Product Advertising API (formerly known as Amazon E-Commerce API, formerly known as just Amazon Web Services back when it was the only one) will require a cryptographic signature on …

I am not using ruby/aws, however. I guess ruby/aws needs to be updated  
to do signing; talk to the developer of that gem, or try to figure out  
how to do it yourself (perhaps guided by the code pointed to above). Or  
stop using ruby/aws and do it yourself manually using the code pointed  
to above.

Jonathan
