oauth-1.0a
Advanced tools
Comparing version 0.0.2 to 0.0.3
{ | ||
"name": "oauth-1.0a", | ||
"version": "0.0.2", | ||
"description": "OAuth 1.0a Request Authorizer for Node and Browser. Send OAuth request with your favorite HTTP client (request, jQuery.ajax...)", | ||
"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.", | ||
"scripts": { | ||
@@ -14,3 +14,6 @@ "test": "mocha", | ||
"oauth1.0a", | ||
"authorize" | ||
"authorize", | ||
"signature", | ||
"nonce", | ||
"consumer" | ||
], | ||
@@ -21,3 +24,4 @@ "author": "Ddo", | ||
"mocha": "~1.17.0", | ||
"chai": "~1.8.1" | ||
"chai": "~1.8.1", | ||
"request": "~2.33.0" | ||
}, | ||
@@ -24,0 +28,0 @@ "dependencies": { |
oauth-1.0a | ||
========== | ||
[![Dependencies](https://api.travis-ci.org/joeddo/oauth-1.0a.png)](https://travis-ci.org/joeddo/oauth-1.0a) | ||
[![Dependency Status](https://gemnasium.com/joeddo/oauth-1.0a.png)](https://gemnasium.com/joeddo/oauth-1.0a) | ||
OAuth 1.0a Request Authorizer for **Node** and **Browser** | ||
@@ -8,5 +11,6 @@ | ||
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. | ||
## Quick Start | ||
Setup | ||
```js | ||
@@ -39,3 +43,3 @@ var oauth = new OAuth({ | ||
###Browser | ||
Download oauth-1.0a.js [here](https://github.com/joeddo/oauth-1.0a) | ||
Download oauth-1.0a.js [here](https://github.com/joeddo/oauth-1.0a/blob/master/lib/oauth-1.0a.js) | ||
@@ -93,3 +97,3 @@ <script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/hmac-sha1.js"></script> | ||
method: request_data.method, | ||
data: oauth.authorizer(request_data, token) | ||
form: oauth.authorizer(request_data, token) | ||
}, function(error, response, body) { | ||
@@ -100,3 +104,3 @@ //process your data here | ||
Or if you want to send OAuth data as header | ||
Or if you want to send OAuth data in request's header | ||
@@ -107,4 +111,4 @@ ```js | ||
method: request_data.method, | ||
data: request_data.data, | ||
header: oauth.toHeader(oauth.authorizer(request_data, token)) | ||
form: request_data.data, | ||
headers: oauth.toHeader(oauth.authorizer(request_data, token)) | ||
}, function(error, response, body) { | ||
@@ -117,2 +121,4 @@ //process your data here | ||
**Caution:** please make sure you understand what happen when use OAuth protocol at client side [here](#client-side-usage-caution) | ||
Init | ||
@@ -160,3 +166,3 @@ ```js | ||
Or if you want to send OAuth data as header | ||
Or if you want to send OAuth data in request's header | ||
@@ -175,3 +181,3 @@ ```js | ||
**If you want a easier way to handle your OAuth request. Please visit [SimpleOAuth](https://github.com/joeddo/SimpleOAuth), it's a wrapper of this project, some features:** | ||
**If you want an easier way to handle your OAuth request. Please visit [SimpleOAuth](https://github.com/joeddo/SimpleOAuth), it's a wrapper of this project, some features:** | ||
@@ -189,3 +195,3 @@ * Request Token method | ||
method: 'GET', | ||
url: 'https://api.twitter.com/1.1/statuses/user_timeline.json', | ||
url: 'https://api.twitter.com/1.1/statuses/user_timeline.json' | ||
}, function(error, response, body) { | ||
@@ -201,3 +207,3 @@ //process your data here | ||
method: 'GET', | ||
url: 'https://api.twitter.com/1.1/statuses/user_timeline.json', | ||
url: 'https://api.twitter.com/1.1/statuses/user_timeline.json' | ||
}.done(function(data) { | ||
@@ -208,2 +214,17 @@ //process your data here | ||
##Client Side Usage Caution | ||
OAuth is based around allowing tools and websites to talk to each other. | ||
However, JavaScript running in web browsers is hampered by security restrictions that prevent code running on one website from accessing data stored or served on another. | ||
Before you start hacking, make sure you understand the limitations posed by cross-domain XMLHttpRequest. | ||
On the bright side, some platforms use JavaScript as their language, but enable the programmer to access other web sites. Examples include: | ||
* **Google/Firefox/Safari extensions** | ||
* **Google Gadgets** | ||
* **Microsoft Vista Sidebar**... | ||
For those platforms, this library should come in handy. | ||
##Todo | ||
@@ -210,0 +231,0 @@ * RSA-SHA1 signature method |
expect = require('chai').expect; | ||
var OAuth = require('../'); | ||
describe("OAuth", function() { | ||
describe("Twitter Sample", function() { | ||
var oauth = new OAuth({ | ||
@@ -6,0 +6,0 @@ consumer: { |
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
22702
9
439
224
0
3