Added passReqToCallback to tumblr oauth strategy to get currently logged in user

pull/2/head
Sahat Yalkabov 2013-12-07 00:29:32 -05:00
parent e05f2eaf7f
commit 6751de2c26
1 changed files with 8 additions and 4 deletions

View File

@ -99,11 +99,15 @@ passport.use('tumblr', new OAuthStrategy({
userAuthorizationURL: 'http://www.tumblr.com/oauth/authorize',
consumerKey: config.tumblr.consumerKey,
consumerSecret: config.tumblr.consumerSecret,
callbackURL: config.tumblr.callbackURL
callbackURL: config.tumblr.callbackURL,
passReqToCallback: true
},
function(token, tokenSecret, profile, done) {
User.findOne({ tumblr: profile.id }, function(err, existingUser) {
function (req, token, tokenSecret, profile, done) {
User.findById(req.user._id, function(err, user) {
user.tokens.tumblr = token;
user.save(function(err) {
done(err);
});
});
}
));