Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

243
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda