Access to req object in success callback

100 Views Asked by At

I need to get access to req object in success callback of Twitter Passport:

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) {
    //here I need `req` object
  }
));

How can I access to that in success callback scope?

1

There are 1 best solutions below

0
On

Ok, found the answer. You need to set passReqToCallback: true in options, then the first parameter of callback will be req object:

https://github.com/jaredhanson/passport/issues/39