From 4f2686b0cfe3cc2db101e0ef7acce3d1e7c7052e Mon Sep 17 00:00:00 2001 From: Maximiliano Delgado Date: Sat, 26 Sep 2020 19:33:39 -0300 Subject: [PATCH] fix verify token --- routes/bot.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/routes/bot.js b/routes/bot.js index 0562122..0ccc124 100644 --- a/routes/bot.js +++ b/routes/bot.js @@ -110,11 +110,7 @@ module.exports = (app) => { app.get(encodeURI(`${context}/webhook/`), (req, res) => { const { verifyToken } = paramsConfig; - const mode = req.query['hub.mode ']; - const token = req.query['hub.verify_token']; - const challenge = req.query['hub.challenge']; - - if (mode === 'subscribe' && token === verifyToken) { + if (req.query['hub.verify_token'] === verifyToken) { setTimeout(() => { functions .doSubscribeRequest() @@ -123,7 +119,7 @@ module.exports = (app) => { prefix: '[subscribe] RESPONSE', message: `Subscription result: ${response.success}` }); - res.status(200).send(challenge); + res.status(200).send(req.query['hub.challenge']); }) .catch((error) => { signale.error({