我使用护照谷歌oauth策略进行了简单的身份验证设置。它工作得很好,但有一个例外。获得回调后,它会设置一个 cookie(使用 session-cookie)并重定向到主页。但不会针对此即时重定向请求发送 cookie。如果我再次重新加载或转到任何页面,cookie 将正确发送并且我已正确登录。
这是重定向的回调代码
router.get(
"/google/callback",
passport.authenticate("google", { failureRedirect: "/login" }),
function (req, res) {
res.redirect("/");
}
);
知道可能是什么原因吗???