Why is my passport-auth0 code causing an infinite redirect

I have the following routes…

router.route("/").get(passport.authenticate("auth0", {
    scope: "openid email profile",
  }), api.hello);
router.get("/callback", (req, res, next)=>{
    passport.authenticate("auth0", {
      scope: "openid email profile",
    }, (err, user, info) => {
      if (err) return next(err);
      if (!user) return res.redirect("/login");
      req.logIn(user, (err) => {
        if (err) return next(err);
    })(req, res, next);

But when I run I get the login page and then I get /callback redirecting back to / which redirects back to callback. I am basically following the steps here (Node.js and Express Tutorial: Authentication Using Passport)

What am I missing?

I changed to passport-auth0-openidconnect and now it is working as expected

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.