ExpressJS本地护照无法注销 [英] Expressjs passport-local can't logout

查看:82
本文介绍了ExpressJS本地护照无法注销的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将应用本地护照复制粘贴到我的应用中,

I copy pasted the app passport-local on my app,

有趣的是,我可以登录用户,但不能使他们注销,

The fun is I can log in users, but I can't make them logout,

app.get('/logout', function(req, res){
  req.logout();
  res.redirect('/');
});

这什么都不做,在日志文件上什么也没有,我有一个指向/logout的链接

this is not doing nothing, nothing on the logfiles, and I I have its a link to /logout

这是主要路线示例

app.get('/page1', function(req, res){                                                                                                                       
  res.render('page1', {user: req.user});
});

app.get('*', function(req,res){
  res.render('root', {user: req.user});
});

为什么注销不起作用????

Why the logout its not working ????

推荐答案

显然这是一个已知问题:

Apparently this is a known problem:

为什么PassionJS在Node中没有删除会话注销

上面提到的线程建议改用 req.session.destroy().

The thread mentioned above suggests to use req.session.destroy() instead.

直接从Passport团队那里获得一些反馈是很好的.

It would be nice to have some feedback from the Passport team directly.

这篇关于ExpressJS本地护照无法注销的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆