0

我正在尝试将 aLinkedInStrategy与现有的LocalStrategy(用户已经过身份验证)结合起来。

这是来自护照文档的示例:

schema.statics.passportLinkedInStrategy = function(token, tokenSecret, profile, done) {
    // asynchronous verification, for effect...
    process.nextTick(function () {
        // To keep the example simple, the user's LinkedIn profile is returned to
        // represent the logged-in user.  In a typical application, you would want
        // to associate the LinkedIn account with a user record in your database,
        // and return that user instead.
        return done(null, profile);
    });
};

问题是我无权req.user检查此回调中的现有会话。

关于我可以/应该怎么做的任何想法?

4

1 回答 1

3

请参阅指南的授权章节中标题为“验证回调中的关联”的部分。

您可以设置一个passReqToCallback选项,它将req作为第一个参数传递给验证回调。

于 2012-12-14T06:27:24.000 回答