oauth-1.0a
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -40,3 +40,3 @@ if(typeof(module) !== 'undefined' && typeof(exports) !== 'undefined') { | ||
/* | ||
OAuth request authorizer | ||
OAuth request authorize | ||
@param {Object} request data | ||
@@ -52,3 +52,3 @@ { | ||
*/ | ||
OAuth.prototype.authorizer = function(request, token) { | ||
OAuth.prototype.authorize = function(request, token) { | ||
var oauth_data = { | ||
@@ -55,0 +55,0 @@ oauth_consumer_key: this.consumer.public, |
{ | ||
"name": "oauth-1.0a", | ||
"version": "0.0.3", | ||
"description": "OAuth 1.0a Request Authorizer for Node and Browser. Send OAuth request with your favorite HTTP client (request, jQuery.ajax...). No more headache about OAuth 1.0a's stuff or \"oauth_consumer_key, oauth_nonce, oauth_signature....\" parameters, just use your familiar HTTP client to send OAuth requests.", | ||
"version": "0.0.4", | ||
"description": "OAuth 1.0a Request Authorization for Node and Browser. Send OAuth request with your favorite HTTP client (request, jQuery.ajax...). No more headache about OAuth 1.0a's stuff or \"oauth_consumer_key, oauth_nonce, oauth_signature....\" parameters, just use your familiar HTTP client to send OAuth requests.", | ||
"scripts": { | ||
@@ -6,0 +6,0 @@ "test": "mocha", |
@@ -6,4 +6,5 @@ oauth-1.0a | ||
[![Dependency Status](https://gemnasium.com/joeddo/oauth-1.0a.png)](https://gemnasium.com/joeddo/oauth-1.0a) | ||
[![NPM version](https://badge.fury.io/js/oauth-1.0a.png)](http://badge.fury.io/js/oauth-1.0a) | ||
OAuth 1.0a Request Authorizer for **Node** and **Browser** | ||
OAuth 1.0a Request Authorization for **Node** and **Browser** | ||
@@ -28,3 +29,3 @@ Send OAuth request with your favorite HTTP client ([request](https://github.com/mikeal/request), [jQuery.ajax](http://api.jquery.com/jQuery.ajax/)...) | ||
```js | ||
oauth.authorizer(request, token); | ||
oauth.authorize(request, token); | ||
``` | ||
@@ -97,3 +98,3 @@ | ||
method: request_data.method, | ||
form: oauth.authorizer(request_data, token) | ||
form: oauth.authorize(request_data, token) | ||
}, function(error, response, body) { | ||
@@ -111,3 +112,3 @@ //process your data here | ||
form: request_data.data, | ||
headers: oauth.toHeader(oauth.authorizer(request_data, token)) | ||
headers: oauth.toHeader(oauth.authorize(request_data, token)) | ||
}, function(error, response, body) { | ||
@@ -158,3 +159,3 @@ //process your data here | ||
type: request_data.method, | ||
data: oauth.authorizer(request_data, token) | ||
data: oauth.authorize(request_data, token) | ||
}).done(function(data) { | ||
@@ -172,3 +173,3 @@ //process your data here | ||
data: request_data.data, | ||
header: oauth.toHeader(oauth.authorizer(request_data, token)) | ||
header: oauth.toHeader(oauth.authorize(request_data, token)) | ||
}).done(function(data) { | ||
@@ -175,0 +176,0 @@ //process your data here |
@@ -27,4 +27,2 @@ var expect = require('chai').expect; | ||
var oauth_data = oauth.authorizer(request, token); | ||
it("should be an array of tweets", function(done) { | ||
@@ -34,3 +32,3 @@ Request({ | ||
method: request.method, | ||
qs: oauth_data, | ||
qs: oauth.authorize(request, token), | ||
json: true | ||
@@ -56,4 +54,2 @@ }, function(err, res, body) { | ||
var oauth_data = oauth.authorizer(request, token); | ||
it("should be an array of tweets (length 5)", function(done) { | ||
@@ -63,3 +59,3 @@ Request({ | ||
method: request.method, | ||
qs: oauth_data, | ||
qs: oauth.authorize(request, token), | ||
json: true | ||
@@ -83,4 +79,2 @@ }, function(err, res, body) { | ||
var oauth_data = oauth.authorizer(request, token); | ||
it("should be an array of tweets", function(done) { | ||
@@ -91,3 +85,3 @@ Request({ | ||
qs: request.data, | ||
headers: oauth.toHeader(oauth_data), | ||
headers: oauth.toHeader(oauth.authorize(request, token)), | ||
json: true | ||
@@ -115,4 +109,2 @@ }, function(err, res, body) { | ||
var oauth_data = oauth.authorizer(request, token); | ||
it("should be an success object", function(done) { | ||
@@ -122,3 +114,3 @@ Request({ | ||
method: request.method, | ||
form: oauth_data, | ||
form: oauth.authorize(request, token), | ||
json: true | ||
@@ -150,4 +142,2 @@ }, function(err, res, body) { | ||
var oauth_data = oauth.authorizer(request, token); | ||
it("should be an success object", function(done) { | ||
@@ -158,3 +148,3 @@ Request({ | ||
form: request.data, | ||
headers: oauth.toHeader(oauth_data), | ||
headers: oauth.toHeader(oauth.authorize(request, token)), | ||
json: true | ||
@@ -161,0 +151,0 @@ }, function(err, res, body) { |
@@ -1,4 +0,11 @@ | ||
expect = require('chai').expect; | ||
var OAuth = require('../'); | ||
var expect; | ||
//Node.js | ||
if(typeof(module) !== 'undefined' && typeof(exports) !== 'undefined') { | ||
expect = require('chai').expect; | ||
var OAuth = require('../'); | ||
} else { //Browser | ||
expect = chai.expect; | ||
} | ||
describe("Twitter Sample", function() { | ||
@@ -13,7 +20,7 @@ var oauth = new OAuth({ | ||
OAuth.prototype.getTimeStamp = function() { | ||
oauth.getTimeStamp = function() { | ||
return 1318622958; | ||
}; | ||
OAuth.prototype.getNonce = function(length) { | ||
oauth.getNonce = function(length) { | ||
return 'kYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg'; | ||
@@ -68,5 +75,5 @@ }; | ||
describe("#authorizer", function() { | ||
describe("#authorize", function() { | ||
it("should be equal to Twitter example", function() { | ||
expect(oauth.authorizer(request, token)).to.eql({ | ||
expect(oauth.authorize(request, token)).to.eql({ | ||
oauth_consumer_key: 'xvz1evFS4wEEPTGEFPHBog', | ||
@@ -87,5 +94,5 @@ oauth_nonce: 'kYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg', | ||
it("should be equal to Twitter example", function() { | ||
expect(oauth.toHeader(oauth.authorizer(request, token))).to.have.property('Authorization', 'OAuth oauth_consumer_key="xvz1evFS4wEEPTGEFPHBog", oauth_nonce="kYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg", oauth_signature="tnnArxj06cWHq44gCs1OSKk%2FjLY%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1318622958", oauth_token="370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb", oauth_version="1.0"'); | ||
expect(oauth.toHeader(oauth.authorize(request, token))).to.have.property('Authorization', 'OAuth oauth_consumer_key="xvz1evFS4wEEPTGEFPHBog", oauth_nonce="kYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg", oauth_signature="tnnArxj06cWHq44gCs1OSKk%2FjLY%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1318622958", oauth_token="370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb", oauth_version="1.0"'); | ||
}); | ||
}); | ||
}); |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
612769
27
19184
225
29
3