Skip to content

Commit

Permalink
fix: sending data for google auth
Browse files Browse the repository at this point in the history
  • Loading branch information
tamalCodes committed Feb 16, 2024
1 parent 694806c commit 1e9fd51
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions routes/user/Auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ router.get("/login/success", (req, res) => {
const data = { User: { id: req.user.email } };
const token = jwt.sign(data, process.env.JWT_SECRET);

const { password, _id, __v, ...userWithoutSensitiveInfo } =
req.user.toObject();
const user = { ...userWithoutSensitiveInfo };

res
.status(STATUSCODE.OK)
.cookie("OAuthLoginInitiated", false, {
Expand All @@ -247,6 +251,7 @@ router.get("/login/success", (req, res) => {
.cookie("usertype", "user", frontendCookie)
.json({
message: STATUSMESSAGE.LOGIN_SUCCESS,
user,
});
} else {
res
Expand Down

0 comments on commit 1e9fd51

Please sign in to comment.