express-openid-connect
    Preparing search index...

    Function requiresAuth

    • Set authRequired to false then require authentication on specific routes.

      const { auth, requiresAuth } = require('express-openid-connect');

      app.use(
      auth({
      ...
      authRequired: false
      })
      );

      app.get('/profile', requiresAuth(), (req, res) => {
      res.send(`hello ${req.oidc.user.name}`);
      });

      Parameters

      Returns RequestHandler