The re authenticate not working
ericbian22 opened this issue · 6 comments
ericbian22 commented
Here is my code
passport.use(new FacebookStrategy({
clientID: process.env.FACEBOOK_APP_ID,
clientSecret: process.env.FACEBOOK_APP_SECRET,
callbackURL: "http://localhost:3000/auth/facebook/Welcome",
profileFields: ["id", "email"],
authType: 'reauthenticate'
},
function (accessToken, refreshToken, profile, cb) {
User.findOrCreate({ username: profile.id },{provider: "facebook",email: profile._json.email},function (err, user) {
return cb(err, user);
}
);
}
));
Later I used
app.get("/Logout",function(req,res){
req.session.destroy((err) => {
req.logout()
res.redirect("/");
});
});
But when I log out, and it logs in with the same account without authentication, so how do I fix this issue?
Nia23 commented
farleyschaefer commented
Hello @ericbian22 did you end up finding a solution to this? :)
farleyschaefer commented
This worked for me #246
ericbian22 commented
This worked for me #246
Hi, I enabled the force re-authenticate option in the facebook developer console but it is doing the same thing
berlincho commented
Same problem here 😭.
babu0008 commented
Here is my code
passport.use(new FacebookStrategy({ clientID: process.env.FACEBOOK_APP_ID, clientSecret: process.env.FACEBOOK_APP_SECRET, callbackURL: "http://localhost:3000/auth/facebook/Welcome", profileFields: ["id", "email"], authType: 'reauthenticate' }, function (accessToken, refreshToken, profile, cb) { User.findOrCreate({ username: profile.id },{provider: "facebook",email: profile._json.email},function (err, user) { return cb(err, user); } ); } ));
Later I used
app.get("/Logout",function(req,res){ req.session.destroy((err) => { req.logout() res.redirect("/"); }); });
But when I log out, and it logs in with the same account without authentication, so how do I fix this issue?
This following is enough to logout from your session.
app.get("/logout", function(req, res){
req.logout();
res.redirect("/");
});