私は、ユーザーが自分のLinkedInプロファイルでログインできるように、Passport for Expressの戦略をエクスプレスで使用しています。 4行目でPassport strategy callbackURLの現在のホストを設定するにはどうすればよいですか?
passport.use(new LinkedInStrategy({
consumerKey: config.linkedin.LINKEDIN_API_KEY,
consumerSecret: config.linkedin.LINKEDIN_SECRET_KEY,
callbackURL: "http://localhost:3000/auth/linkedin/callback"
},
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);
});
}
));
が、私は手動で完全なコールバックURLを設定する必要があります。
は、私は、次のコードを持っています。私は生産用と開発用にそれぞれ1つの文字列を使用していましたが、URLは変わっていませんでした。
URLの最初の部分(http://localhost:3000
)を自動的に設定するにはどうすればよいですか?私がそれを可能にするexpress
またはapp
の特性がありますか? app.use(function(req, res){});
に行く必要がありますか?
ありがとうございます!私のconfig.jsので
あなたのアプリがルートパス上で実行されていない場合、 '/'の代わりに '/ myapp'で実行されている場合などは、動作しません。 –