When making a http request to "https://example.com/api" - the console throws an error

Refused to connect to...because it violates the following Content Security Policy directive: "connect-src http://localhost:*...

enter image description here

How can I resolve this error?

1

There are 1 best solutions below

0
On

To make 3rd party API requests in your UI extension you mus specify the endpoints to be allowlisted in your "content_security_policy": { "connect-src": [] } You can use the Stripe CLI to grant the URL permission:

stripe apps grant url "https://*.api.example.com/path/" "Send data to example service..."

For full reference, see the Stripe Apps docs.