Study/Node.js

Node.JS에러 - 로그아웃 오류(Error: req#logout requires a callback function)

토기발 2022. 11. 21. 18:21

node프로젝트 작업 중 에러가 났다.

 

이 코드에서

 

이 에러가 났다.

 

stackoverflow를 찾아보니 passport 0.6 출시 이후로 req.logout이 비동기로 변경되어 위 코드로는 작동이 안된다고 한다.

그래서 아래 코드로 수정하였더니 로그아웃이 잘 된다.^^ 

 

router.get('/logout', function(req, res, next) {
  req.logout(function(err) {
    if (err) { return next(err); }
    res.redirect('/');
  });
});

 

 

 

https://stackoverflow.com/questions/72336177/error-reqlogout-requires-a-callback-function

 

Error: req#logout requires a callback function

can't able to find solution of this tried everything, i am just new in using passport. Error: req#logout requires a callback function i have coded this before but that time i have not received any...

stackoverflow.com

해당 질문-답 링크는 이쪽!