Created
March 27, 2013 05:04
-
-
Save vishaltelangre/5251796 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm install rem read | |
var rem = require('rem'), | |
fs = require('fs'), | |
read = require('read'); | |
var tw = rem.connect('twitter.com', '1.1'), | |
oauth = rem.oauth(tw); | |
// Add whichever API keys you want to test here. | |
// Including the iPhone/Android apps, these keys are configured as "desktop" | |
// applications, and so include an OOB token you must enter manually. | |
tw.configure({ | |
key: ... | |
secret: ... | |
}); | |
oauth.start(function(url, token, secret) { | |
console.log("Visit:", url); | |
read({ | |
prompt: "Type in the verification code: " | |
}, function(err, verifier) { | |
oauth.complete(verifier, token, secret, authorizedRequests); | |
}); | |
}); | |
function authorizedRequests(err, user) { | |
if (err) return console.log(err); | |
user('statuses/home_timeline').get(function(err, json) { | |
console.log(err, json); | |
}) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment