Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Jira Webhook HMAC authentication not consistent NODE JS

Antonio Chelala
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 18, 2024

Hello all,

 

I hope you are doing well.

 

I have been trying to implement the HMAC authentication system with my incoming webhooks from Jira to my Node JS program. However, I have been getting problems doing so: a lot of the HMAC authentication fails and some fail.

 

I think it has something to do with the way Node JS is parsing the body of the incoming post request


This is my code:

var bodyParser = require('body-parser')

app.use(bodyParser.json()) // I have tried to use other parameters such as extended 

app.post('pathForWebhook', (req,res) =>{
const hmac = createHmac('sha256',process.env.JIRA_HMAC_TOKEN)




hmac.update(Buffer.from(JSON.stringify(req.body), 'utf8'));




let digest = hmac.digest('hex');




digest = 'sha256=' + digest




console.log(JSON.stringify(req.body))

logger.verbose('Digest is: ' +digest)

logger.verbose('REQ ' + req.headers["x-hub-signature"])

})

 

 

Please advise

Best

Antonio

 

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events