📜  facebook graph X-Hub-Signature - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:15.507000             🧑  作者: Mango

代码示例1
const FB_APP_SECRET = 'your facebook app secret';

// requires
const crypto = require('crypto');

const verifyXHubSignature = req => {
    const digest = crypto
    .createHmac('sha1', FB_APP_SECRET)
    .update(req.rawBody)
    .digest('hex');
    return req.headers['x-hub-signature'] === `sha1=${digest}`;
};