#baoleduc
1 messages · Page 1 of 1 (latest)
So your Stripe App is attempting to get resources from your external server?
yes
What are you trying to load from the external server?
yes, it's from an external server (my server)
Right, but what is the resource it's trying to get?
it's an API that I want to load data from and render on the UI using UI Extensions
Hi 👋
By chance could you share your stripe-app.json file?
I think I missed this setup part https://stripe.com/docs/stripe-apps/build-ui#use-third-party-apis. It's partially working now. Thanks
I was going to ask about that. CSP errors usually mean you need to configure your API in the file. For instance, an old integration of mine using a Heroku back-end had this.
content_security_policy": {
"connect-src": [
"https://stripe-apps-backend.herokuapp.com/account"
],
"image-src": null,
"purpose": "Get account info"
}
Here is a snippet of my stripe-app.json
"connect-src": [
"https://cowardly-bear-87.telebit.io/notes",
"https://cowardly-bear-87.telebit.io/notes/*",
"https://cowardly-bear-87.telebit.io/note"
],
When I tried to upload to Stripe, it said
invalid stripe-app.json:
found violation for connect-src "https://cowardly-bear-87.telebit.io/notes/*": path cannot contain wildcard
How can I add a parameter after a base path?
I think you would need to encode it as a query parameter ?param=foo rather than a part of the URL path
We only allow wildcards for subdomains as we mention in our docs
If using a wildcard (), it must be in the left-most DNS label (example: https://.example.com/api/users/).
But also, if you read the details for the connect-src URL, you will see you don't need the wildcard
Adding a base path with a trailing slash covers all paths after it (example: https://www.example.com/api/ enables calls to https://www.example.com/api/users/abc123/address).
So https://cowardly-bear-87.telebit.io/notes/ would cover every path that comes after notes/