Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

240
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!