fix: proper custom state store for OIDC, catch errors on login route

pull/7973/head
Gabriel Mowses (Mouse) 2 weeks ago
parent 85a92abfa3
commit c32ab31175

@ -45,7 +45,8 @@ export default function () {
strategyId: req.params.strategy
}, { req, res })
} catch (err) {
next(err)
WIKI.logger.error(`OAuth login error: ${err.message}`)
res.redirect('/login?error=' + encodeURIComponent(err.message))
}
})

@ -19,7 +19,10 @@ module.exports = {
callbackURL: conf.callbackURL,
passReqToCallback: true,
skipUserProfile: false,
store: { verify: (req, state, cb) => cb(null, true), store: (req, ctx, appState, meta, cb) => cb(null, ctx.state) }
store: new (class {
store(req, ctx, appState, meta, cb) { cb(null, ctx.state || 'state') }
verify(req, providedState, cb) { cb(null, true) }
})()
}, async (req, iss, sub, profile, cb) => {
try {
const user = await WIKI.db.users.processProfile({

Loading…
Cancel
Save