小编Bri*_*ian的帖子

使用 Passport.js 登录后如何通过 React 进行“重定向”?

新手反应问题:我\xe2\x80\x99m 将其与passport.js 和express 一起使用。I\xe2\x80\x99m 成功登录应用程序。但我不知道如何进行重定向。

\n\n
router.post('/login',\n  passport.authenticate('local'),\n  function(req, res) {\n    // If this function gets called, authentication was successful.\n    res.redirect('/upload'); //<\xe2\x80\x94\xe2\x80\x94 what I\xe2\x80\x99d like to do is some kind of redirect here\n});\n
Run Code Online (Sandbox Code Playgroud)\n\n

任何帮助表示赞赏。

\n

express reactjs passport.js

5
推荐指数
1
解决办法
8992
查看次数

标签 统计

express ×1

passport.js ×1

reactjs ×1