我试过从角度上使用HttpClient。
export class RegisterationService {
constructor(private http : HttpClient) { }
connectShopify(){
return this.http.get('https://shop-name.myshopify.com/admin/api/2022-04/shop.json', {headers: {"Access-Control-Allow-Origin":"*", 'Content-Type': 'application/Json', 'X-Shopify-Access-Token': 'access_token'}})}但这给了我以下错误。
https:/shop-name.myshopify.com/admin/api/2022-04/shop.json
CORS Missing Allow Origin
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://sanklecha-clothing.myshopify.com/admin/api/2022-04/shop.json. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 401.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://sanklecha-clothing.myshopify.com/admin/api/2022-04/shop.json. (Reason: CORS request did not succeed). Status code: (null).发布于 2022-04-27 08:55:49
为了发出http请求,您需要为您的角应用程序设置一个Shopify代理来进行通信。
请查看有关如何做到这一点的文档:
https://stackoverflow.com/questions/72025501
复制相似问题