Next, we'll set up a route in the Express application to request the OAuth tokens from Twitter:
app.get('/requestOAuth', function(req, res){
function recieveOAuthRequestTokens(error, oauth_token, oauth_token_secret,results) {
if (!error){
req.session.oAuthVars = { oauth_token: oauth_token,oauth_token_secret: oauth_token_secret}; res.redirect('https://api.twitter.com/oauth/authorize?oauth_token=' + oauth_token);
}
requestOAuthRequestTokens(recieveOAuthRequestTokens);
});
function requestOAuthRequestTokens(onComplete){
getOAuth().getOAuthRequestToken(onComplete);
}