出於某種原因,我不能做這項工作保護尤伯杯網絡掛接不工作
require crypto = require('crypto')
const hmac = crypto.createHmac('sha256', 'clientSecret')
const hash = hmac.update(JSON.stringify(req.body)).digest('hex')
if (hash !== req.header('X-Uber-Signature')) {
return res.json('something is wrong ' + hash + ' ' + req.header('X-Uber-Signature'))
}
return res.json('you got in!')
我在這裏的下一條指令https://developer.uber.com/docs/riders/guides/webhooks#security
但哈希生成不同的值
的其他方法同樣歡迎。
什麼是您所期望的價值是什麼?你得到什麼? –