0

I'm trying to access the Amazon Product Advertising API through javascript, but whether I'm using axios or an all-in-one solution like apac, I get an "Access-Control-Allow-Origin" error. I don't see anywhere in Amazon's documentation on how to resolve this..

Here is the error:

No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://localhost:8080' is therefore not allowed access. 
If an opaque response serves your needs, set the request's mode 
to 'no-cors' to fetch the resource with CORS disabled.

I also see nowhere documenting how to set the request mode to 'no-cors'. Does anyone have a workaround for this?

brunam
  • 825
  • 2
  • 14
  • 26
  • please add the code, it hard to understand what you are doing – Devstr Feb 13 '18 at 20:02
  • googling the error message surfaces this question, for example: https://stackoverflow.com/questions/36292537/what-is-an-opaque-request-and-what-it-serves-for – Devstr Feb 13 '18 at 20:03

1 Answers1

4

This API is intended to be used by server-side applications. It is not designed to be used by Javascript applications -- such a usage would be insecure, as you would be exposing your API key to the client.