-
-
Save drudge/f60a49a498d13c1bcf36 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
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 }); | |
}); | |
}; |
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
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