How to use the oauth-sign.hmacsign256 function in oauth-sign

To help you get started, we’ve selected a few oauth-sign examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github request / request / tests / test-oauth.js View on Github external
var http = require('http')

function getSignature (r) {
  var sign
  r.headers.Authorization.slice('OAuth '.length).replace(/, /g, ',').split(',').forEach(function (v) {
    if (v.slice(0, 'oauth_signature="'.length) === 'oauth_signature="') {
      sign = v.slice('oauth_signature="'.length, -1)
  return decodeURIComponent(sign)

// Tests from Twitter documentation

var hmacsign = oauth.hmacsign
var hmacsign256 = oauth.hmacsign256
var rsasign = oauth.rsasign
var rsaPrivatePEM = fs.readFileSync(path.join(__dirname, 'ssl', 'test.key'))
var reqsign
var reqsign256
var reqsignRSA
var accsign
var accsign256
var accsignRSA
var upsign
var upsign256
var upsignRSA

tape('reqsign', function (t) {
  reqsign = hmacsign('POST', '',
    { oauth_callback: 'http://localhost:3005/the_dance/process_callback?service_provider_id=11',
      oauth_consumer_key: 'GDdmIQH6jhtmLUypg82g',


OAuth 1 signing. Formerly a vendor lib in mikeal/request, now a standalone module.

Latest version published 6 years ago

Package Health Score

71 / 100
Full package analysis

Similar packages