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

241
Visualizações
Building an SSO login scenario in NodeJS

I am trying To build an SSO scenario using NodeJS using this an example URL: https://jira.amazone.de/ When you access this page the website will ask you to enter a username and password and in the second step it will ask you for a pin code from google authenticator my goal is to keep listening to the page and when the user enter the pin code I should read a cookie value to check if the user is signed in or no I am having a problem to keep listening to the page while the user login the below code is what I did so far but it will only list the cookie in the first page which is before even the user login

app.get("/ssologin", function (req, res) {
// var url = req.headers["url"];
// var lastChar = url.charAt(url.length - 1);
// if (lastChar == "/") {
//   url = url.slice(0, -1);
// }
res.redirect("https://jira.amazone.de")
 res.on("finish", () => {
   console.log("finshed")
   const cookies = parseCookies(req);
   console.log(cookies)
  })
 })
 function parseCookies(request) {
  const list = {};
  const cookieHeader = request.headers?.cookie;
    if (!cookieHeader) return list;
     cookieHeader.split(`;`).forEach(function (cookie) {
     let [name, ...rest] = cookie.split(`=`);
     name = name?.trim();
    if (!name) return;
     const value = rest.join(`=`).trim();
     if (!value) return;
     list[name] = decodeURIComponent(value);
   });

   return list;
 }
about 4 years ago · Santiago Trujillo
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