Hi,
please, someone can help me with this.
I'm trying to verify the X-Fitbit-Signature (node.js)
var hmac = crypto.createHmac('sha1', FITBIT_CLIENT_SECRET + '&');
var requestHash = hmac.update(req.body.toString()).digest('base64');
if (requestHash !== req.get('x-fitbit-signature')) {
.........
something is worng, I never get a succes calculated hmac digest.
I can recieve the notificatios.
Answered! Go to the Best Answer.
Best Answersolved
var data = JSON.stringify(req.body);
var requestHash = hmac.update(data).digest('base64');
Best Answer
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
@clarisa: One important detail: You should verify the signature *before* you JSON.parse the request body. JavaScript does not guarantee Object property ordering, which means that the body string sent by the server may not be the same string returned by JSON.stringify.