到目前为止,我一直在使用客户端身份验证。我刚刚设置了服务器端的 everyauth,它运行良好,但是我如何在页面加载时执行 FB.getLoginStatus
(我在客户端所做的)之类的操作?
如果用户已经登录,我不想让他们再次经历这个过程。
感谢您的解释!
最佳答案
everyauth also provides convenience methods on the ServerRequest instance req. From any scope that has access to req, you get the following convenience getters and methods:
req.loggedIn
- a Boolean getter that tells you if the request is by a logged in user
req.user
- the User document associated with the session
req.logout()
- clears the sesion of your auth data
在快速 View 中:
If you are using express, everyauth comes with some useful dynamic helpers. To enable them:
var express = require('express') , everyauth = require('everyauth') , app = express.createServer(); everyauth.helpExpress(app);
Then, from within your views, you will have access to the following helpers methods attached to the helper, everyauth:
everyauth.loggedIn
关于javascript - 如何检查用户是否已经登录? (everyauth,node.js),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9029217/