Hi there, I’m making my webhooks from GraphQL api and trying to check the validity of the webhook but I can’t get them to match together.
Here is how I proceed:
const hmac = req.headers["x-shopify-hmac-sha256"];
const hash = crypto.createHmac("sha256", shop.adminToken).update(req.rawBody, "utf8", "hex").digest("base64");
if (crypto.timingSafeEqual(Buffer.from(hash), Buffer.from(hmac))) {
console.log("...");
}
shop.adminToken is my “Develop apps” Admin API Secret Key (so the one also used for creating the admin api instance that created the webhook).