0

LinkedInStrategyを既存のものと組み合わせようとして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、verifyコールバックの最初の引数として渡されます。

于 2012-12-14T06:27:24.000 に答える