Oidc middleware issues: ensureAuthenticated() doesn't work and userinfo isn't set

Hi @JMK, thank you for providing your code. You should be able to solve your problem by moving app.use(oidc.router); above your other route definitions. The OIDC router sets up all the middleware that is needed to later use oidc.ensureAuthenticated(). We will update our documentation to make this clearer.

I also see that you have a call to oidc.ensureAuthenticated() inside of your protected route handler, that should be removed.

1 Like