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!