Skip to content

Instantly share code, notes, and snippets.

@tcr
Created March 7, 2013 14:42
Show Gist options
  • Save tcr/5108489 to your computer and use it in GitHub Desktop.
Save tcr/5108489 to your computer and use it in GitHub Desktop.
Testing Twitter official API keys
// 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