From 08569a220ad3cad86312d33abc193522b9e6ec0f Mon Sep 17 00:00:00 2001 From: Azat Mardanov Date: Thu, 21 Mar 2013 17:23:33 -0700 Subject: [PATCH] Update Readme.md added OAuth 1.0 example --- Readme.md | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index 362e2fe..38e687b 100644 --- a/Readme.md +++ b/Readme.md @@ -18,9 +18,38 @@ Examples To run examples/tests insall Mocha `$ npm install -g mocha` and run `$ mocha you-file-name.js`: +## OAuth1.0 + ```javascript -describe('OAuth',function(){ - var request = require('superagent'); +describe('OAuth1.0',function(){ + var OAuth = require('OAuth'); + + it('tests trends Twitter API v1.1',function(done){ + var oauth = new OAuth.OAuth( + 'https://api.twitter.com/oauth/request_token', + 'https://api.twitter.com/oauth/access_token', + "your application consumer key', + "your application secret", + '1.0A', + null, + 'HMAC-SHA1' + ); + oauth.get( + 'https://api.twitter.com/1.1/trends/place.json?id=23424977', + "your user toke for this app", //test user token + "your user secret for this app", //test user secret + function (e, data, res){ + if (e) console.error(e); + console.log(require('util').inspect(data)); + done(); + }); + }); +}); +``` + +## OAuth2.0 +```javascript +describe('OAuth2',function(){ var OAuth = require('OAuth'); it('gets bearer token', function(done){