Skip to content

Commit f49313f

Browse files
committed
passport callbacks
1 parent a06c6a9 commit f49313f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

server/services/passport.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ passport.use(
1616
User.findOne({ googleId: profile.id }).then(existingUser => {
1717
if (existingUser) {
1818
// we already have a record with the given profile ID
19+
done(null, existingUser);
1920
} else {
2021
// we don't have a user record with this ID, make a new record!
21-
new User({ googleId: profile.id }).save();
22+
new User({ googleId: profile.id })
23+
.save()
24+
.then(user => done(null, user));
2225
}
2326
});
2427
}

0 commit comments

Comments
 (0)