Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

102
Visualizações
How do I pass the user's server side request to the client side?

I don't know if I phrased the title correctly, so sorry if it confused you.

I have two servers running (using different ports), one is my client side running on React, and the other one is my server side running on Express. I'm trying to have the user log in via Steam, so I'm using the passport-steam library. Basically, when the user logs in on steam, it passes the user data to the server-side req session, but I need it to be on the client-side so it can access the data and load it on the website.

Here's some code if that helps

// /routes/auth.js
// /AUTH ROUTER

// GET Request the CLIENT will send to get their info
router.get("/user", ensureAuthenticated, function (req, res) {
  res.json(req.session.user);
  // returns undefined because their session is saved on the server side
});

// GET Requests used to sign in and authenticate
router.get("/steam", passport.authenticate("steam", { failureRedirect: "http://localhost:3000/login" }), function (req, res) {
  res.redirect("http://localhost:3000");
});

router.get("/steam/return", passport.authenticate("steam", { failureRedirect: "http://localhost:3000/login" }), async function (req, res) {
  res.redirect("http://localhost:3000");
});
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda