Skip to content

jschneider98/node-oauth-validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-oauth-validator

Build Status Scrutinizer Code Quality Code Coverage Dependency Status Coverage Status

Simple server side Oauth validation. We're talking one legged Oauth here.

Installation

$ npm install git://github.com/jschneider98/node-oauth-validator.git --save

Usage

var OAuthValidator = require('node-oauth-validator');

// Should be retrieved from request header
var authString = 'OAuth oauth_consumer_key="consumer_key",oauth_nonce="8OBpuvFSRwgdU7Q0oFkqa13XwGfGMXym",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1452891729",oauth_token="user_key",oauth_version="1.0A",oauth_signature="Qp6Q5fp2fJ6Y6SelcPGGK%2Fs%2FluI%3D"'

var requestUrl = 'http://localhost:3000';
var accessUrl = requestUrl;
var fullUrl = requestUrl + '/test/param_1=test';
var consumerKey = 'consumer_key';
var consumerSecret = 'consumer_secret';
var oauthVersion = '1.0A';
var signatureMethod = 'HMAC-SHA1';
var callback = null;

var httpRequestMethod = 'GET';
var userKey = 'user_key';
var userSecret = 'user_secret';

var oauthValidator = new OAuthValidator.OAuthValidator(
    requestUrl,
    accessUrl,
    consumerKey,
    consumerSecret,
    oauthVersion,
    callback,
    signatureMethod
);

var isValid = oauthValidator.isValid(
        fullUrl,
        userKey,
        userSecret,
        httpRequestMethod,
        authString
    );

console.log('isValid: ' + isValid);

Tests

$ npm test

About

Simple server side oauth validation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published