OK. The first thing to do, is to get your App Proxy setup correctly.
I am assuming you have created some kind of form, in your Theme App Extension. You need to make sure that you use something like fetch() or axios() to post your data to your Admin App.
App Proxy setup:
You should point the proxy at a Remix route, so, for example:
app/routes folder:
app.api.jsx
Then the App Proxy URL would be:
[https://mydomain.trycloudflare.com/app/api](https://mydomain.trycoludflare.com/app)
Then your fetch() URL would be like:
/subpath_prefix/subpath[/route_path]
So let’s say your subpath_prefix value is apps and your subpath is app-proxy, then the form action or fetch() URL will be:
/apps/app-proxy/api
So what actually happens when the data is posted by a fetch() XHR request? Well, the request is intercepted by Shopify and the URL is analysed to see if it matches an App Proxy value. If there is a match, the data is forwarded to the App Proxy proxy URL value. Then, query params are added onto the end of the proxy URL.
These params include:
- logged_in_customer_id
- path_prefix
- timestamp
- signature
Example:
GET /?index=value&example.myshopify.com&logged_in_customer_id=1234567890&path_prefix=%2Fa%2Fexample×tamp=1234567890&signature=XXXXXXXXXX
The signature is important. It is made up of all the other query param values, which are sorted & then hashed. The signature is created using:
[createSHA256HMAC()](https://github.com/Shopify/shopify-api-js/blob/main/packages/shopify-api/runtime/crypto/utils.ts#L6)
https://github.com/Shopify/shopify-api-js/blob/main/packages/shopify-api/runtime/crypto/utils.ts#L6
App Proxy fetch() URL:
Note that, you don’t have to add the domain part of the URL, in the fetch() URL param.
Please remember that form POST requests, hit the:
Remix action() method
And GET requests, hit the:
Remix loader() method
If you still have problems, let me know and I will go through other potential problems, including invalid signature.