Skip to content

Instantly share code, notes, and snippets.

@drudge
Created November 19, 2012 20:46
Show Gist options
  • Save drudge/f60a49a498d13c1bcf36 to your computer and use it in GitHub Desktop.
Save drudge/f60a49a498d13c1bcf36 to your computer and use it in GitHub Desktop.
var request = require('request');
AuthController.twitterReverseAuth = function() {
var self = this;
request.post({
url: 'https://api.twitter.com/oauth/request_token'
, oauth: {
consumer_key: self.app.set('twitter client key')
, consumer_secret: self.app.set('twitter client secret')
}
, form: {
x_auth_mode: 'reverse_auth'
}
}, function (err, r, body) {
if (err) {
return self.response.send(500, { message: e.message });
}
if (body.indexOf('OAuth') !== 0) {
return self.response.send(500, { message: 'Malformed response from Twitter' });
}
self.response.send({ x_reverse_auth_parameters: body });
});
};
var request = require('request');
app.post('/auth/twitter/reverse', function(req, res) {
var self = this;
request.post({
url: 'https://api.twitter.com/oauth/request_token'
, oauth: {
consumer_key: app.set('twitter client key')
, consumer_secret: app.set('twitter client secret')
}
, form: {
x_auth_mode: 'reverse_auth'
}
}, function (err, r, body) {
if (err) {
return res.send(500, { message: e.message });
}
if (body.indexOf('OAuth') !== 0) {
return res.send(500, { message: 'Malformed response from Twitter' });
}
res.send({ x_reverse_auth_parameters: body });
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment