Set authRequired to false then require authentication on specific routes.
false
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}`);}); Copy
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}`);});
Optional
Set authRequired to
false
then require authentication on specific routes.