-2

I have tried using HttpClient from angular.

     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'}})}

But this is giving me the following error.

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).
Bozhinovski
  • 2,496
  • 3
  • 20
  • 38
  • Does this answer your question? [AngularJS : Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource](https://stackoverflow.com/questions/23665056/angularjs-cross-origin-request-blocked-the-same-origin-policy-disallows-readi) – Arnie97 Apr 27 '22 at 16:55

1 Answers1

0

In order to make http requests you will need to setup a Shopify Proxy for your Angular app to communicate with.

Please check the documentation about how to do that:

https://shopify.dev/apps/online-store/app-proxies

Bozhinovski
  • 2,496
  • 3
  • 20
  • 38