我正在使用VueJs中shopify的管理API进行一些Api调用。问题是,我相当确定我必须发送很长时间的密钥和密码才能让它工作。也就是说它已经暴露在我的网站上了。我怎么才能隐藏它呢?或者我使用了错误的设置?
我在其他地方找不到这个问题,所以我非常确定我是愚蠢的。帮助!下面是我的代码。
async mounted () {
let config = {
headers: {
'X-Shopify-Access-Token': 'Access-Token',
}
}
let apikey = 'apikey ';
let apipass = 'apipass ';
let url = 'url.myshopify.com';
let getrequest = '/admin/api/2020-01/products.json?limit=200';
await axios.get('https://'+ apikey + apipass + '@' + url + getrequest, config)
.then(response => this.products = response.data.products).catch( error => { console.log(error);
});
this.sortAfterCategory();
if(custombundle == true) {
this.custombundle = true;
}
if(this.cart_count >= 3 && actualItems >= 3 || this.custombundle == true) {
return this.EnableAddToCartButton();
}
},
delimiters: ['${', '}'],
});发布于 2020-03-27 00:55:35
正确的答案是在您的商店中安装一个应用程序,并在该应用程序中设置应用程序代理。一旦这样做了,您就可以使用JS从前端代码进行调用,这一切都是安全的,并且您可以返回所需的所有Admin API数据。
https://stackoverflow.com/questions/60872019
复制相似问题