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 3 (3)

Liam
Shopify Staff
2731 299 769
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
Shopify Staff
2731 299 769

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