On Cloud Code on Parse Im trying to verify the header x-hub-signature received from Facebook webhook.
secret
is the right secret-key of the Facebook app.
var
hmac,
expectedSignature,
payload = JSON.stringify(req.body),
secret = 'xyzxyzxyz';
hmac = crypto.createHmac('sha1', secret);
hmac.update(payload, 'utf-8');
expectedSignature = 'sha1=' + hmac.digest('hex');
console.log(expectedSignature);
console.log(req.headers['x-hub-signature']);
but the signatures never match. What is wrong?