3rd Party API

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.

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.

Can I have example code please?

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

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