我使用护照登录facebook时遇到问题。我有这个:
//PASSPORT
passport.use(
new FacebookStrategy(
{
clientID: keys.id,
clientSecret: keys.secret',
callbackURL: '/auth/facebook/callback',
proxy: true
},
async (accessToken, refreshToken, profile, done) => {
const user = await User.findOrCreate({ facebookID: profile.id });
if (user) done(null, user);
}
)
);
//AUTH ROUTES
module.exports = app => {
app.get('/auth/facebook', passport.authenticate('facebook'));
app.get(
'/auth/facebook/callback',
passport.authenticate('facebook'),
(req, res) => {
res.redirect('/');
}
);
};
我试图让它在localhost:3000上运行。在我的Facebook开发的应用程序设置中,我有网站url:localhost:3000和appdomain到localhost。但是......它不起作用。当我去(/ auth / facebook)我得到一条消息(类似于此):
无法加载网址:此网址的网址未包含在内 应用领域......