我有一个像这样的简单护照路由器
app.get('/auth/facebook',
passport.authenticate('facebook',{ scope: ['user_likes', 'user_location'],
session: true
})
);
app.get('/auth/facebook/callback',
passport.authenticate('facebook'), (req, res) => {
var messengerApp = 'https://m.me/appUserName';
res.redirect(messengerApp || '/');
});
app.get('/', function( req, res ){
res.header( 'Content-Type', 'text/html' );
res.status(200).send('<html><body><a href="/auth/facebook">Login with Facebook</a></body></html>');
});
此代码会将用户重定向到Messenger,但会跳过Login部分。如果我擦除messengerApp ||
,代码将重定向到登录按钮,但是一旦单击该按钮,用户将被重新切换到相同的登录按钮页面“/”。
如何将用户重定向到他在Bot on Messenger上的对话?