arkerone/api-key-auth

Bad signature

Closed this issue · 1 comments

I tired your example and the signature help file to create a request using the following, but I kept receiving bad signature:
what am I doing wrong?
thanks

const crypto = require('crypto');
const currentDate = new Date().toString();
const signingString = date: ${currentDate};
const signature = crypto
.createHmac('sha1', '123456789')
.update(signingString)
.digest('base64');

My request is:
`POST /protected HTTP/1.1
Host: localhost:3000
Accept: application/json
Authorization: Signature keyId="123456789",algorithm="hmac-sha1",signature="${signature}"
date: ${currentDate}
Content-Length: 85

Code_1=5555&Code_2=99999`

OK never mind, I was using .createHmac('sha1', '123456789') instead of .createHmac('sha1', 'secret1')