OAuth Modules for Node.js - Supporting RSA, HMAC, PLAINTEXT, 2,3-Legged, 1.0a, Echo, XAuth, and 2.0
npm install mashape-oauth
Using OAuth (1.x, XAuth, Echo):
var OAuth = require('mashape-oauth').OAuth;
var oa = new OAuth({ /* ... options ... */ }, callback);Argument Documentation
- options
{Object}OAuth Request Options- echo
{Object}Optional; If it exists we treat the request as an echo request. See Twitter. - echo.verifyCredentials
{String}What is the credentials URI to delegate against? - realm
{String}Optional; Access Authentication Framework Realm Value, Commonly used in Echo Requests, allowed in all however: Section 3.5.1 - requestUrl
{String}Request Token URL, Section 6.1 - accessUrl
{String}Access Token URL, Section 6.2 - callback
{String}URL the Service Provider will use to redirect User back to Consumer after obtaining User Authorization has been completed. Section 6.2.1 - consumerKey
{String}The Consumer Key - consumerSecret
{String}The Consumer Secret - version
{String}Optional; By spec this is1.0by default. Section 6.3.1 - signatureMethod
{String}Type of signature to generate, must be one of:- PLAINTEXT
- RSA-SHA1
- HMAC-SHA1
- nonceLength
{Number}Optional; Length of nonce string. Default32 - headers
{Object}Optional; Headers to be sent along with request, by default these are already set. - clientOptions
{Object}Optional; ContainsrequestTokenHttpMethodandaccessTokenHttpMethodvalue. - parameterSeperator
{String}Optional; Seperator for OAuth header parameters, default is,
- echo
- callback
{String}Optional; callback uri, over-rides options callback.
Using OAuth2:
var OAuth2 = require('mashape-oauth').OAuth2;
var oa = new OAuth2({ /* ... options ... */ }, callback);Argument Documentation:
- options
{Object}OAuth Request Options- clientId
{String}Client Identifier - clientSecret
{String}Client Secret - baseUrl
{String}Base url of OAuth request - authorizationUrl
{String}Optional; Authorization endpoint, default is/oauth/authorize - authorizationMethod
{String}Optional; Authorization Header Method, default isBearer - accessTokenUrl
{String}Optional; Access Token Endpoint, default is/oauth/access_token - accessTokenName
{String}Optional; Access Token Parameter Name, default isaccess_token - headers
{Object}Optional; Custom headers we wish to pass along
- clientId