NEED HELP in HMAC Validation

Girish_Rajwani
Shopify Partner
70 1 7
const hmac_header = req.get('X-Shopify-Hmac-Sha256');
 
const map = Object.assign({}, req.query);
delete map['hmac'];
const message = querystring.stringify(map);

const genHash = crypto
.createHmac('sha256', process.env.SHOPIFY_API_SECRET)
.update(JSON.stringify(message))
.digest('hex');

if(genHash === hmac_header){
Valid
} else {
Invalid request
}
 
but i am getting invalid request error
 
I followed below youtube video 
 
 
in above video, they are comparing as 
if(genHash === hmac
 
but it should compare with hmac in the header send by Shopify, please correct me if i am wrong 
 
i tried above as well, and got below error
 
Received an error response (400 Bad Request) from Shopify:
If you report this error, please include this id:
 
Please help!
 
Thanks in advance 🙂 
Replies 0 (0)