Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does not get secret file after registering with google instead of secret file i get js object (my id and google id). #35

Open
prince-sunsara opened this issue Jun 8, 2023 · 0 comments

Comments

@prince-sunsara
Copy link

app.get("/auth/google",
passport.authenticate("google", { scope: ["profile"] }),
function(req, res) {
// Successfull authentication, redirect to secrets.
res.redirect("/auth/google/secrets");
}
);

app.get("/auth/google/secrets",
passport.authenticate('google', { failureRedirect: "/login" }),
function(req, res) {
// Successful authentication, redirect to secrets.
res.redirect("/secrets");
});

app.post("/register", (req, res) => {
User.register({ username: req.body.username}, req.body.password, (err, user) => {
if(err){
// console.log(err);
res.redirect("/register");
} else {
passport.authenticate("local")(req, res, (err) => {
if(!err) res.redirect("/secrets");
else console.log(err);
});
}
});
});

app.get("/secrets", (req, res) => {
if(req.isAuthenticated()){
res.render("secrets");
} else {
res.redirect("/login");
}
});

any problem here ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant