diff options
Diffstat (limited to '')
-rw-r--r-- | lib/auth.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/auth.js b/lib/auth.js index ec45eea3..087937b7 100644 --- a/lib/auth.js +++ b/lib/auth.js @@ -23,21 +23,22 @@ function callback(accessToken, refreshToken, profile, done) { accessToken: accessToken, refreshToken: refreshToken } - }).spread(function(user, created) { + }).spread(function (user, created) { if (user) { - if(user.accessToken == accessToken){ + if (user.accessToken == accessToken) { if (config.debug) logger.info('user login: ' + user.id); return done(null, user); } user.accessToken = accessToken; - user.save().then(function(){ + user.refreshToken = refreshToken; + user.save().then(function () { if (config.debug) logger.info('user login: ' + user.id); return done(null, user); }) } - }).catch(function(err) { + }).catch(function (err) { logger.error('auth callback failed: ' + err); return done(err, null); }) |