Authentication error after migrating to forest-express-sequelize v7

Hello @agarbund,

I managed to make it work with your repository and a small change:

in app.js I changed

app.use('/forest', (request, response, next) => {
  if (PUBLIC_ROUTES.includes(request.url)) {
    return next();
  }
  return ensureAuthenticated(request, response, next);
});

Into

app.use('/forest', (request, response, next) => {
  if (PUBLIC_ROUTES.includes(request.path) || request.method === "OPTIONS") {
    return next();
  }
  return ensureAuthenticated(request, response, next);
});

This code is not executed in the context of standalone agents, for public routes, but in your case it was filtering calls to public routes.

With this small change & the latest version of forest-express-sequelize, the authentication is running smoothly and the app is exposing the forest agent under /admin.

1 Like