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

202
Views
Why is ensureLogin not working when I am using passport-auth0-openidconnect?

I have a simple express webapp and I am trying to add auth. Everything seems to work fine, I see the connect.sid in the cookies etc, but when I tried to access the following endpoint...

this.app.get("/user",
  ensureLoggedIn("/login"),
  function(req, res) {
    res.json(req.user || {});
});

It redirects me to login instead of letting me through. What am I missing?

When I debug I can see that the problem is req.isAuthenticated is false. I am not sure why because I login and see the cookie. I can also logout and be presented with the Login screen so I am confused.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

In my case I had been calling passport.session() before I setup express session. This fixed it....

enter image description here

about 4 years ago · Juan Pablo Isaza Report
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!