2

I am using passport-twitter to add a twitter connect to my website.

User can connect via different actions and I'd like to redirect them to different pages depending on where they clicked.

So far I am using the same callback url every login:

passport.use(new TwitterStrategy({
    consumerKey: TWITTER_CONSUMER_KEY,
    consumerSecret: TWITTER_CONSUMER_SECRET,
    callbackURL: "http://127.0.0.1:3000/auth/twitter/callback"
  },
  function(token, tokenSecret, profile, done) {
   // some code
  }
));

Here I'd like to add a parameter passed to my twitter strategy to define which callbackURL to use:

app.get('/auth/twitter/:option',
  passport.authenticate('twitter'));

How can I do this?

Many thanks

laggingreflex
  • 32,948
  • 35
  • 141
  • 196
Spearfisher
  • 8,445
  • 19
  • 70
  • 124
  • When you say callback, are you talking about the verify callback from Twitter? If so, can you give an example of why you'd want different verify callbacks rather than one? – Matthew Bakaitis Apr 12 '14 at 16:23
  • To give a concrete example: my users can login by 2 ways - either they click on connect or either they click on 'post something'. if they click on connect they have the usual twitter connect and are redirected to the user page. However if they click on 'post something' they have the same process except that when the user page is loaded, I'd like a modal to appear to enable users to post something. Right know I dont know how to make the difference between the 2 actions – Spearfisher Apr 13 '14 at 18:58

0 Answers0