Skip to content

Commit

Permalink
Fixing "Failed to serialize user into session"
Browse files Browse the repository at this point in the history
  • Loading branch information
jim-sheldon committed Apr 22, 2022
1 parent 1ced726 commit a6f5b73
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions verification/curator-service/api/src/controllers/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export class AuthController {
if (err) return next(err);
});

res.status(200).json(user);
return res.status(200).json(user);
},
)(req, res, next);
},
Expand Down Expand Up @@ -633,7 +633,8 @@ export class AuthController {
// @ts-ignore
passport.serializeUser((user: IUser, done: any) => {
// Serializes the user id in the cookie, no user info should be in there, just the id.
done(null, user._id);
// _id needed for configureLocalAuth
done(null, user.id || user._id);
});

passport.deserializeUser((id: string, done: any) => {
Expand Down Expand Up @@ -710,9 +711,9 @@ export class AuthController {
<p>The G.h Team</p>`,
);

done(null, userPublicFields(newUser));
return done(null, userPublicFields(newUser));
} catch (error) {
done(error);
return done(error);
}
},
),
Expand Down

0 comments on commit a6f5b73

Please sign in to comment.