gpt4 book ai didi

javascript - LoggedIn undefined in everyauth

转载 作者:行者123 更新时间:2023-11-30 13:26:56 25 4
gpt4 key购买 nike

我的代码曾经可以工作,几天后因为 cloud9ide 不能正常工作而没有碰它,它停止工作了。我总是在 everyauth 模块中得到一个未定义的 req.loggedin。我做了一个简单的:

app.get('/view/:htmlpage', function(req, res){
console.log(req);
if(req.loggedIn) {
res.sendfile('./views/' + req.params.htmlpage + '.html');
}
else{

res.send('You need to be authenticated with a <a href="www.facebook.com">Facebook</a>');

}
});

请求打印:

{ session :

 // IGNORE ALL KIND OF STUFF //

"loggedIn":true,"userId":"4ec448e67a06792a32000006"}}' },
hash: [Function],
generate: [Function] },

怎么了?一切似乎都找到了,但我仍然不确定...???

这里是请求的一个更大的摘录:

 sessionStore:
{ sessions:
{ 'OoYpzK3P9V5EuVzsaIzcENKA.u86589nxU+3B5y/DZ/GUWmLLd4hKiVMZQlM3uXpkpdk': '{"lastAccess":1321711710418,"cookie":{"originalMaxAge":14400000,"expires":"2011-11-19T18:08:30.421Z","httpOnly":true,"path":"/"}}',
'ro6CtsS269MqF9DhXHIYVzfi.VVqZHKF6DcGewMbS+myRWbeev6oMmJZEqWQ6oq0Y2mE': '{"lastAccess":1321711711837,"cookie":{"originalMaxAge":14400000,"expires":"2011-11-19T18:08:31.838Z","httpOnly":true,"path":"/"}}',
'AjXcalemAKkn534BBNDd1ouq.rl/JpdRKMMDoIuEj2IwEe77oesx5ZghAK4fInJT44ZQ': '{"lastAccess":1321711712927,"cookie":{"originalMaxAge":14400000,"expires":"2011-11-19T18:08:33.839Z","httpOnly":true,"path":"/"},"auth":{"facebook":{"user":{"id":"x","name":"x x","first_name":"x","last_name":"x","link":"http://www.facebook.com/x","username":"x","location":{"id":"x","name":"x, Ontario"},"education":[{"school":{"id":"x","name":"x"},"year":{"id":"x9","name":"2005"},"type":"High School"},{"school":{"id":"x","name":"x"},"year":{"id":"x","name":"2010"},"concentration":[{"id":"x","name":"x"}],"type":"x"}],"gender":"male","email":"x","timezone":-5,"locale":"fr_CA","verified":true,"updated_time":"2011-11-16T13:38:18+0000"},"accessToken":"AAAD8xT5k5w8BAIbAjZBe0z20idA2qSFIxBJXyQUVqHK0yDCSjYiyZCbtahwup8lpNN8ijWwVhJy5ZAPdwsb8IQoL2EUBq8FVtREjrY3V2gkhQObdC4u"},"loggedIn":true,"userId":"4ec448e66a06792c32000006"}}' },
hash: [Function],
generate: [Function] },
sessionID: 'SwW3fTOcQYCsJ7bRPJI3DsK4.YUolspdQE6fgM4gE/o6HNQfDrX+o94aTfgd4G8Hgv1k',
session:
{ lastAccess: 1321711713901,
cookie:
{ path: '/',
httpOnly: true,
_expires: Sat, 19 Nov 2011 18:08:33 GMT,
originalMaxAge: 14400000 } },
logout: [Function],
_route_index: 1,

最佳答案

使用

if(req.session.loggedIn)

相反。

session 是请求对象的一部分。

关于javascript - LoggedIn undefined in everyauth,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8160456/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com