summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCheng-Han, Wu2016-05-16 12:46:48 +0800
committerCheng-Han, Wu2016-05-16 12:46:48 +0800
commit6b521b99d406b5b32720407d70726c7462ba646f (patch)
treea3ebd2a09b6799a455bdae70e963bed7b96bd836
parent6e9cb49c27c445ec701a191a3dd770ac9640ffc1 (diff)
Fix code styles and user refreshToken might need update when accessToken not match
-rw-r--r--lib/auth.js9
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);
})