English 中文(简体)
如何在... 找到"全能"的Orcreate用户 上 获得 Express conditionID?
原标题:How to obtain Express sessionID on .findOrCreateUser of Everyauth?

我试图在.findOrCreate用户的 Everyauth 上获取 Expressessalession

" 强 " 问题: " 强 " 问题

基本上,我试图整合Socket.IO和Express, 并阅读

我可以从套接字.IO范围获得ExpressalessalID ,这对我的项目设计很重要。

io.sockets.on( connection , function (socket) {
    console.log( A socket with sessionID   + socket.handshake.sessionID 
        +   connected! );
});

So far so good... Then, I also need to obtain Express sessionID on .findOrCreateUser of Everyauth.

虽然我是《百老汇》的初学者, 我设法获得Facebook/google/Twitter用户ID等,

everyauth.facebook
    .entryPath( /auth-facebook )
    .appId(conf.fb.appId)
    .appSecret(conf.fb.appSecret)
    .findOrCreateUser(function (session, accessToken, accessTokenExtra, fbUserMetadata)
    {
        console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
        console.log(session); //  <-- if this session object includes sessionID, everything works for me..
        console.log(fbUserMetadata);
        return usersByFbId[fbUserMetadata.id] ||
            (usersByFbId[fbUserMetadata.id] = addUser( facebook , fbUserMetadata));
    })
    .redirectPath( /public/authdone.html );

节点/ js 控制台. log 如下:

2012-05-24T18:59:31+00:00 app[web.1]: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
2012-05-24T18:59:31+00:00 app[web.1]: { lastAccess: 1337885971024,
2012-05-24T18:59:31+00:00 app[web.1]:   cookie: 
2012-05-24T18:59:31+00:00 app[web.1]:    { path:  / ,
2012-05-24T18:59:31+00:00 app[web.1]:      httpOnly: true,
2012-05-24T18:59:31+00:00 app[web.1]:      _expires: Thu, 24 May 2012 22:59:30 GMT,
2012-05-24T18:59:31+00:00 app[web.1]:      originalMaxAge: 14400000 },
2012-05-24T18:59:31+00:00 app[web.1]:   auth: 
2012-05-24T18:59:31+00:00 app[web.1]:    { twitter: 
2012-05-24T18:59:31+00:00 app[web.1]:       { token:  w0HH4lrzMfeqCLOwd4ncHoPndlyHHqMvyXZM5mGhx8 ,
2012-05-24T18:59:31+00:00 app[web.1]:         tokenSecret:  Pzfooy4UVRZpwXvPMJRDFXUX1LdMN59hZwz4ZkBIOc  },
2012-05-24T18:59:31+00:00 app[web.1]:      facebook: 
2012-05-24T18:59:31+00:00 app[web.1]:       { user: [Object],
2012-05-24T18:59:31+00:00 app[web.1]:         accessToken:  AAACrg6U8ThcBAG4QVDvIM5Qjd2gsjc3jYnHBas7g0w5QcdUJ0cgXXYBBCnmNaz8exdiFLtgXvruoErZCCXX9yitSZB3SIoAB0cKSPguAZDZD  },
2012-05-24T18:59:31+00:00 app[web.1]:      loggedIn: true,
2012-05-24T18:59:31+00:00 app[web.1]:      userId: 1,
2012-05-24T18:59:31+00:00 app[web.1]:      google: 
2012-05-24T18:59:31+00:00 app[web.1]:       { user: [Object],
2012-05-24T18:59:31+00:00 app[web.1]:         accessToken:  ya29.AHES6ZRq_AFBJNLG92rSuqApI7dmE0fSq12AifJ14nxNNwlJ6OsFo58  } } }

推特、脸书和Google 校对信息显然通过明确会议适当收集,

.findOrCreateUser(function (session... doesn t include Express sessionID

How to obtain Express sessionID on .findOrCreateUser of Everyauth, appropirately? Thanks.


编辑 编辑 编辑 编辑 编辑 编辑

此职位后, 我试图执行

everyauth.facebook
    .entryPath( /auth-facebook )
    .appId(conf.fb.appId)
    .appSecret(conf.fb.appSecret)
    .findOrCreateUser(function (session, accessToken, accessTokenExtra, fbUserMetadata)
    {
        console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
        console.log(session);
        console.log(fbUserMetadata);
        return usersByFbId[fbUserMetadata.id] ||
            (usersByFbId[fbUserMetadata.id] = addUser( facebook , fbUserMetadata));
    })
    .findUserById(function (req, userId, callback)
    {
        console.log("######################################");
        console.log(req.sessionID);
    })
    .redirectPath( /public/authdone.html );

但是,. findedUserById(职能(req, userId, 回调))从未被解雇...

最佳回答

OK,OK, OK, OK, OK, OK, OK, OK, OK,OK, OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,

我应该做

console.log(session.id);

但是,我想整个目标内容 出现 当我只是做主控台.log(会话)时;

问题回答

暂无回答




相关问题
why the session in iis automatically log out?

I used iis6, and when i called a function Directory.delete(), the all the session relate this website will be logged out. and i debugged the website, i found no exception. any one have ideas on this ? ...

Check session from a view in CodeIgniter

What is the best way to check session from a view in CodeIgniter, it shows no way in their user guide, otherwise I will have to make two views on everything, which is kinda weird...still a newbie to ...

Can I get the size of a Session object in bytes in c#?

Is it possible to get the size(in bytes) of a Session object after storing something such as a datatable inside it? I want to get the size of a particular Session object, such as Session["table1"], ...

提供严格分类的出席会议物体

提供严格分类的与会机会的最佳方式是什么? 我正计划转而选择矩阵,这正在促使汇编者抱怨我的幻觉方案拟订方法......

PHP Session is not destroying after user logout

I m trying to create an authentication mechanism for my PHP Application and I m having difficulty destroying the session. I ve tried unsetting the authentication token which was previously set within ...

热门标签