Node.js OpenID、Express、React-通过身份验证将获得的令牌从后端发送到前端
身份验证后,用户被重定向到Node.js OpenID、Express、React-通过身份验证将获得的令牌从后端发送到前端,node.js,reactjs,express,openid,Node.js,Reactjs,Express,Openid,身份验证后,用户被重定向到/auth/steam/authenticate,url中存储的数据将使用函数steam.authenticate保存到JWT令牌中,在此之后,我尝试使用令牌将用户重定向到我的前端,但我不知道如何在我的前端处理该请求,因为我没有从它发送请求 目标:将我的前端中的用户令牌保存为cookie app.get("/auth/steam/authenticate", (req, res) => { try { steam.authentic
/auth/steam/authenticate
,url中存储的数据将使用函数steam.authenticate
保存到JWT令牌中,在此之后,我尝试使用令牌将用户重定向到我的前端,但我不知道如何在我的前端处理该请求,因为我没有从它发送请求
目标:将我的前端中的用户令牌保存为cookie
app.get("/auth/steam/authenticate", (req, res) => {
try {
steam.authenticate(req.url).then((user) => {
const token = jwt.sign(user._json, process.env.JWT_TOKEN);
return res.redirect("http://localhost:3000/"); //Frontend
});
} catch (error) {
console.error(error);
}
});