From 74ae8adacec2c43e201c1448041f1b0492c1393d Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 13 Apr 2016 18:33:23 -0400 Subject: [PATCH] fixed location of onSuccessfulLogin call --- library.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/library.js b/library.js index c17b5ea..9626d00 100644 --- a/library.js +++ b/library.js @@ -79,7 +79,6 @@ if (err) return done(err); profile.provider = constants.name; - authenticationController.onSuccessfulLogin(req, user.uid); done(null, profile); }); } catch(e) { @@ -102,7 +101,6 @@ if (err) return done(err); profile.provider = constants.name; - authenticationController.onSuccessfulLogin(req, user.uid); done(null, profile); }); } catch(e) { @@ -112,7 +110,9 @@ }; } - passport.use(constants.name, new passportOAuth(opts, function(token, secret, profile, done) { + opts.passReqToCallback = true; + + passport.use(constants.name, new passportOAuth(opts, function(req, token, secret, profile, done) { OAuth.login({ oAuthid: profile.id, handle: profile.displayName, @@ -122,6 +122,8 @@ if (err) { return done(err); } + + authenticationController.onSuccessfulLogin(req, user.uid); done(null, user); }); }));