egg icon indicating copy to clipboard operation
egg copied to clipboard

egg-passport oauth2策略,如何开启路由认证,将登陆认证存入session?

Open Yunfly opened this issue 8 years ago • 2 comments

目前ctx.isAuthenticated()在路由中默认为true,只能清除cookie或者触发this.logout() 才能清除登陆状态让isAuthenticated返回false,关闭浏览器也不行 怎么能像koa这种设置路由session呢,想把项目从koa迁到egg,就是一直卡在登陆这块。。。。。。。。

附地址:https://github.com/Yunfly/egg-passport-oauth2

Yunfly avatar Sep 11 '17 10:09 Yunfly

好像 egg-passport 默认用了 sessionStratege,要等 @fengmk2 回来看看

popomore avatar Oct 09 '17 08:10 popomore

@Yunfly 在授权验证成功之前,ctx. isAuthenticated() 的值是 false,验证成功后才是 truesession 是存在 cookie 里面,是有有效期的,所以关闭浏览器也不行,如果你想清除登录状态,是否可以做个退出按钮让用户点击退出呢?

OnedayLiu avatar Dec 10 '17 13:12 OnedayLiu