简体   繁体   English

可以从Javascript(Chrome扩展程序)访问Amazon Product API吗?

[英]Can the Amazon Product API be accessed from Javascript (Chrome Extension)

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

Does anyone know if the API can be accessed without including my secret key? 有没有人知道是否可以在不包含我的密钥的情况下访问API? Has anyone done this using Javascript (and in particular from a Chrome extension that allows me to get ignore the same origin policy). 有没有人使用Javascript(特别是Chrome扩展程序,允许我忽略相同的原始政策)完成此操作。

Looking into this it really seems like this can't be done directly from Javascript without potentially exposing your secret key. 考虑到这一点,看起来似乎无法直接从Javascript完成此操作而不会泄露您的密钥。 The only options I've discovered are: 我发现的唯一选择是:

  1. Host a server to do the work for you and talk directly to your server using Javascript 托管服务器为您完成工作,并使用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. 我发现的一个例子是http://apisigning.com/service.html - 基本上是收费的他们似乎签署了你的请求。 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. 有点令人失望的是,亚马逊不允许更容易地访问他们的数据,但我猜他们认为他们必须保护它免受竞争对手的侵害。

I guess you need a server to do your request! 我想你需要一台服务器来做你的请求! Lets the extension send the resquest to your server and there the request to amazon is done (php). 让扩展程序将resquest发送到您的服务器,并在那里完成对amazon的请求(php)。 The result of that you can use in your extension! 您可以在扩展中使用的结果!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 有没有什么好的亚马逊 api,我可以用来从产品名称中获取产品详细信息? - is there any good WORKING amazon api, that i can use to get a product details from the name of the product? 有没有办法制作一个 function 可以稍后在谷歌浏览器扩展中访问? - Is there a way to make a function that can be accessed later in a google chrome extension? Chrome扩展API中的JavaScript OOP和异步方法 - JavaScript OOP and asynchronous methods from Chrome extension api 难以从Chrome扩展程序下载API访问Javascript中的对象属性 - Difficulty accessing object property in Javascript from Chrome Extension Downloads API 我可以从代码中启动Chrome扩展程序API吗? - Can I fire up a Chrome extension API from code? 无法从 Chrome 扩展程序向 REST API 发送 POST 请求 - Can't send POST request to a REST API from a Chrome extension 从Chrome扩展程序访问API - Accessing API from Chrome extension Chrome阻止JavaScript扩展 - Chrome blocking javascript from extension 如何将 popup.js 文件中的单个字符串变量传递给 chrome 扩展 API 上的单独 javascript 文件? - How can I pass a single string variable from a popup.js file to a seperate javascript file on chrome extension API? 带有流星的Amazon Product API - Amazon Product API with meteor
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM