Skip to content

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

@prince-sunsara

Description

@prince-sunsara

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions