Skip to content

Instantly share code, notes, and snippets.

@vishaltelangre
Created March 27, 2013 05:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vishaltelangre/5251796 to your computer and use it in GitHub Desktop.
Save vishaltelangre/5251796 to your computer and use it in GitHub Desktop.
// 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