Happening now | Shopify Community AMA: SEO Basics with 2H Media | Ask your questions now!
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: 3rd Party API

3rd Party API

Lucent
Shopify Partner
2 0 0

I'm trying to implement 3rd party API and its working on localhost. But after deployment on oxygen server refusing API due to content security policy, Can you please help me to resolve it.

Replies 4 (4)

Liam
Community Manager
3108 344 911
Hi Lucent,
 
In Oxygen, you have to take care of Content Security Policy (CSP) headers by yourself. These headers dictate which resources can be loaded by your web application. It's likely that the 3rd-party API you're trying to connect to is not listed in your CSP header and is therefore being blocked. To resolve this issue, you need to update your CSP header and add your 3rd-party API there.

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Lucent
Shopify Partner
2 0 0

Can I have example code please?

Liam
Community Manager
3108 344 911

We have an example implementation of Oxygen with a Hydrogen store in our docs, if this is helpful?

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

jamalsoueidan
Shopify Partner
66 3 10

Because you are doing it client side, you need to call your 3rd party server side, either in action or loader, then you dont need to modify the CSP