Skip to content

request/oauth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@request/oauth

See @request/core for more details.

Options

Required
  • oauth {} see below
  • uri url.parse()'d object
  • method GET | POST ..
Optional
  • query a=1&b=2
  • form a=1&b=2
  • body {a:1,b:2}

OAuth Options

Required
  • consumer_key OAuth application key
  • consumer_secret OAuth application secret
  • private_key in PEM format, set this key instead of consumer_secret when using RSA-SHA1 signing
  • token user's access token
  • token_secret user's token secret
Defaults
  • version 1.0
  • signature_method HMAC-SHA1 | RSA-SHA1 | PLAINTEXT
  • transport_method type header | query | form
Generated
  • timestamp
  • nonce
  • signature
Optional
  • realm
  • body_hash pass you own Body Hash as string or pass true to get one generated for you

Result

Error
var result = oauth(options)
if (result instanceof Error) {
  // handle error
}
Success
var result = oauth(options)

var transport = options.oauth.transport_method || 'header'
if (transport === 'header') {
  req.headers['authorization'] = result
}
else if (transport === 'query') {
  // append result to your querystring
}
else if (transport === 'body') {
  // append result to your form body
}

Notice

This module may contain code snippets initially implemented in request by request contributors.

About

HTTP OAuth Authentication

Resources

License

Stars

Watchers

Forks

Packages

No packages published