Hey :),
im trying to veryfiy webhooks in my nodejs app. but it just doesnt work, here is my code :
app.use(shopify.config.webhooks.path, async (req, res, next) => {
if (!req.body) {
return res.status(401).send("Couldn't verify incomming Webhook request!");
}
const hmac = req.headers["x-shopify-hmac-sha256"];
const genHash = crypto
.createHmac("sha256", process.env.SHOPIFY_API_SECRET)
.update(JSON.stringify(req.body), "utf8", "hex")
.digest("base64");
console.log(hmac);
console.log(genHash);
if (genHash !== hmac) {
return res.status(401).send("Couldn't verify incomming Webhook request!");
}
next();
});
Please help meee