Requisição a API dando erro de permissão (dominio), usando javascript

Olá!

Estou usando javascript para fazer uma requisição à API category/tree e brand/list, que ambas precisam do token e key. Colocando os headers e configurações no ajax, não funciona localhost ou em outro dominio (que preciso usar em outro site q usa wordpress). Só funciona quando eu uso esse ajax dentro da vtex... Está faltando alguma configuração?

$.ajax({ headers: { "Accept": "application/vnd.vtex.ds.v10+json", "Content-Type": "application/json", "x-vtex-api-AppKey": key, "x-vtex-api-AppToken": token }, dataType: 'json', url: url, type: 'GET', data: data, success: (response) => {} ...

O erro que dá qnd tenta acessar /api/catalog_system/pub/category/tree/10 usando localhost

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access. The response had HTTP status code 405.

Mesmo colocando no header 'Access-Control-Allow-Origin': "*", nada muda..

Thnx!

@Jéssica Westphal​ qual a url completa que você está tentando realizar o request?

@Nathan Prestes​ Oii, a url seria:

https://nomedosite.vtexcommercestable.com.br/api/catalog_system/pub/category/tree/10

@Jéssica Westphal​ não sei o que pode ser... o correto seria fazer com uma linguagem server-side fora da VTEX, mas não sei se interfere em algo.

did you fined any solution for this problem? y just use js and html y don´t have the posibility to change any more.