【发布时间】:2015-04-18 02:37:08
【问题描述】:
我正在制作一个通过 Facebook 对用户进行身份验证的应用。 我对 Sails 和 Passport 都很陌生,所以我决定关注这个存储库:https://github.com/stefanbuck/sails-social-auth-example
我忠实地关注了这个存储库,并且能够如此轻松地使用 facebook 进行登录功能,但注销功能不起作用。
在 routes.js 中是:
'/logout' : {
controller : 'auth',
action : 'logout'
}
在 AuthController.js 中是:
logout: function (req, res) {
req.logout();
res.redirect('/');
}
当我停止服务器提升时,似乎已注销,下次执行命令sails lift时,它会警告我:
warn: handshake error No cookie transmitted with socket.io connection. Are you trying to access your Sails.js server via socket.io on a 3rd party domain? If you're ok with losing users' session data, you can set `authorization: false` to disable cookie-checking. Or you can send a JSONP request first from the client to the Sails.js server to get the cookie (be sure it's the same domain!!)
我不明白如何处理。
你能告诉我哪里出了问题,我该如何让它发挥作用?
- 帆 v0.0.4
- 护照 v0.3.4
- passport-facebook v1.0.0
【问题讨论】:
-
你可以先尝试销毁会话对象;
req.session.destroy然后在回调中您可以重定向。res.redirect.
标签: node.js sails.js passport.js