在 Express 我正在使用:
var router = express.Router();
router.get('/auth/*', function (req, res, next) {
next();
})
app.use(router);
app.all('/*', function(req, res) {
res.sendfile('index.html', { root: __dirname + '/app/dist' });
});
在 Angular $routeProvider 中:
when('/auth/:type', {}).
当我使用社交登录到 Meetup/auth/meetup
时,它会进行身份验证,但不会重新路由到/profile/meetup
successRedirect Passport 中指定的路径:
app.get('/auth/meetup', passport.authenticate('meetup', { scope : 'email' }));
app.get('/auth/meetup/callback',
passport.authenticate('meetup', {
successRedirect : '/profile/meetup',
failureRedirect : '/login'
}));
当我单击一个按钮时,href="/auth/meetup"
我会在地址栏中看到一个带有 url 的空白屏幕:http://localhost:2997/auth/meetup
当我刷新页面时,我会自动被路由到,'/profile/meetup'
因此身份验证成功。
为什么 Node/Express/Angular 在身份验证后不重定向到 /profile/meetup?