Shopify / product-reviews-sample-app

A sample Shopify application that creates and stores product reviews for a store, written in Node.js
MIT License
355 stars 158 forks source link

Authentication failure when calling app rest endpoint from theme extension #73

Open MohamedBouzid opened 1 year ago

MohamedBouzid commented 1 year ago

What is the problem you are facing?

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:

Problem:

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:

Regards

Describe the solution you'd like to see

I won't to see my app responding with 200 ok

Anything else?

No response