可以从Javascript(Chrome扩展程序)访问Amazon Product API吗? [英] Can the Amazon Product API be accessed from Javascript (Chrome Extension)

查看:148
本文介绍了可以从Javascript(Chrome扩展程序)访问Amazon Product API吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在玩Chrome扩展程序,我想做的一件事是从亚马逊产品广告API 。执行此操作的代码非常简单,但到目前为止,我可以找到访问API的唯一方法是创建一个签名请求,其中涉及使用您的AWS公钥和密钥。不幸的是,这意味着将我的AWS密钥嵌入Chrome扩展程序,允许任何人访问它们,因此这显然是不行的。

I've been playing about with Chrome extensions and one of the things I'd like to do is request product information from the Amazon Product Advertising API. The code to do this is pretty straight forward but so far the only way I can find to access the API is to create a signed request which involves using your AWS public and secret keys. Unfortunately this would mean embedding my AWS keys in the Chrome Extension which would allow anyone to access them so this is obviously a no go.

有谁知道API是否可以不包括我的密钥访问?有没有人使用Javascript(特别是Chrome扩展程序,允许我忽略相同的原始政策)完成此操作。

Does anyone know if the API can be accessed without including my secret key? Has anyone done this using Javascript (and in particular from a Chrome extension that allows me to get ignore the same origin policy).

推荐答案

调查一下,看起来这似乎无法直接从Javascript完成而不会泄露您的密钥。我发现的唯一选项是:

Looking into this it really seems like this can't be done directly from Javascript without potentially exposing your secret key. The only options I've discovered are:


  1. 托管服务器为您完成工作并使用Javascript直接与您的服务器通信

  2. 使用将为您进行签名的托管服务。我发现的一个例子是 http://apisigning.com/service.html - 基本上是收费的他们似乎在签署您的请求。请注意,我还没有测试过这个。

  1. Host a server to do the work for you and talk directly to your server using Javascript
  2. Use a hosted service that will do the signing for you. One example I've found is http://apisigning.com/service.html - basically for a fee they appear to sign the request for you. Note that I haven't tested this.

可悲的是,我认为这些选项都比我计划的要多一些使用所以我现在放弃了我的扩展。有点令人失望的是,亚马逊不允许更容易地访问他们的数据,但我猜他们认为他们必须保护它免受竞争对手的侵害。

Sadly, I think both of these options are a bit more than I'd planned on using so I've given up on my extension for now. It's a bit disappointing that Amazon don't allow easier access to their data but I guess they feel they have to protect it from competitors.

这篇关于可以从Javascript(Chrome扩展程序)访问Amazon Product API吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆