Hello,
I’m trying to add a button in the theme.
Use case: Click on the button changes the value of a metafield attached to an order, and I’ll get the new value of the metafield
shown on the page.
Solution I managed to put together so far:
- Create a theme app extension: in the liquid containing the button, there’s an api call to an endpoint (/app/xxx/status)
- Create an App proxy that exposes the above endpoint and defines the logic for it: calls the Admin API to get the metafield
Problem:
- The request from the store is not going through: I have the authentication problem below :
https://mystore.myshopify.com/api/auth?oseid=xxxxxxx&shop=mystore.myshopify.com 404
Code:
I am using thee same logic as the generated code :
app.get(“/api/products/count”, async (_req, res) => {
const countData = await shopify.api.rest.Product.count({
session: res.locals.shopify.session,
});
res.status(200).send(countData);
});
and then calling this endpoint from the theme extension.
Question:
- How can I get this request go through ?
- How to authenticate the request coming from the store to the app proxy then to the Admin API?
- How can I see the logs of my app ?
- Is there an example to accomplish this ?
Regards