Skip to content

Commit

Permalink
Troubleshoot
Browse files Browse the repository at this point in the history
  • Loading branch information
VikramjeetD authored and AetherPrior committed Jun 13, 2020
1 parent 541ca90 commit 173c11f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server/routes/api/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ authRouter.get(
);

authRouter.get("/loggedin", loggedIn, function (req, res) {
console.log("in loggedin");
if (req.user) {
console.log("loggedin found user");
res.status(200).send(req.user);
} else {
console.log("loggedin no user");
res.status(401).json({ msg: "Unauthorized" });
}
});


authRouter.get(
"/auth/google/callback",
passport.authenticate("google"),
Expand All @@ -41,9 +43,12 @@ authRouter.get("/logout", (req, res) => {
});

authRouter.get("/current_user", loggedIn, (req, res) => {
console.log("currentuser");
if (req.user) {
console.log("currentuser found user");
res.status(200).send(req.user);
} else {
console.log("currentuser no find user");
res.status(401).json({ msg: "Unauthorized" });
}
});
Expand Down

0 comments on commit 173c11f

Please sign in to comment.