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

The re authenticate not working #277

Open
ericbian22 opened this issue Aug 12, 2020 · 6 comments
Open

The re authenticate not working #277

ericbian22 opened this issue Aug 12, 2020 · 6 comments

Comments

@ericbian22
Copy link

ericbian22 commented Aug 12, 2020

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
Copy link

Nia23 commented Aug 15, 2020

@farleyschaefer
Copy link

Hello @ericbian22 did you end up finding a solution to this? :)

@farleyschaefer
Copy link

This worked for me #246

@ericbian22
Copy link
Author

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
Copy link

Same problem here 😭.

@babu0008
Copy link

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("/");
});

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

5 participants