Marwan
01/19/2021, 4:45 PMstalbert
01/19/2021, 4:56 PMMarwan
01/19/2021, 4:57 PMcreece
01/19/2021, 7:22 PMbattk
01/19/2021, 8:52 PMbattk
01/19/2021, 8:53 PMMarwan
01/19/2021, 10:46 PMbattk
01/19/2021, 10:47 PMMarwan
01/19/2021, 11:08 PMclass Oauth1Helper {
static getAuthHeaderForRequest(request) {
const oauth = oauth1a({
consumer: { key: CONSUMERKEY, secret: CONSUMERSECRET },
signature_method: 'HMAC-SHA1',
hash_function(base_string, key) {
return crypto
.createHmac('sha1', key)
.update(base_string)
.digest('base64')
},
})
const authorization = oauth.authorize(request, {
key: TOKENKEY,
secret: TOKENSECRET,
});
return oauth.toHeader(authorization);
}
}
module.exports = Oauth1Helper;
Marwan
01/19/2021, 11:10 PMMarwan
01/19/2021, 11:10 PMbattk
01/19/2021, 11:11 PMbattk
01/19/2021, 11:11 PMMarwan
01/19/2021, 11:47 PM