code: function (req, res, next) {
        debug("ensureAuthenticated:", req.url);
        if (req.isAuthenticated()) {
          return next();
        }
        req.session._redirectUrl = req.url;
        res.redirect('/auth/familysearch');
      }
docs: Simple route middleware to ensure user is authenticated. Use this route middleware on any resource that needs to be protected.  If the request is authenticated (typically via a persistent login session), the request will proceed.  Otherwise, the user will be redirected to the login page.