Hi
I am using express-openid-connect and am trying to have different middleware config based on the protected API server I want to call. Trying to do that gives me an Error: req[appSession] is already set, did you run this middleware twice?
The code is as below
const config = {
authRequired: false,
routes: { login: false },
auth0Logout: true,
baseURL: 'https://localhost/',
clientID: '....',
clientSecret: '....',
issuerBaseURL: '...',
secret: 'LONG_RANDOM_STRING',
};
app.use('/', auth(config));
app.use(
'/proxy/api',
auth({
...config,
authorizationParams: {
response_type: 'code',
audience: '....',
scope: 'openid profile email',
prompt: 'consent',
},
session: { cookie: { path: '/' } },
})
);
Any help would be appreciated.
Thanks!