代码之家  ›  专栏  ›  技术社区  ›  Shan Khan

Passport身份验证重定向到绝对URL失败

  •  1
  • Shan Khan  · 技术社区  · 6 年前

    我想将请求重定向到另一个URL,以及通过 passport 在里面 express

    app.get('/auth/facebook/callback', function (req, res, next) {
        var authenticator = passport.authenticate('facebook', {
            successRedirect: "http://localhost:3200/#/home/",
            failureRedirect: '/'
        });
    

    问题是它不会重定向到指定的url和查询中的代码,这样我也可以在angular app中管理状态。

    1 回复  |  直到 6 年前
        1
  •  0
  •   zishe    5 年前

    你应该把 passport.authenticate function (req, res, next) :

    app.get('/auth/facebook/callback', passport.authenticate('facebook', {
        successRedirect: "http://localhost:3200/#/home/",
        failureRedirect: '/'
    }));