Reciveing 400 bad request when trying to log out user from idp session. The user is logged out from the application/passport session, but not from the idp session.
Logout and callback endpoints are set up like seen below. The logout endpoint attach the required attributes to logout the user and to create the SAMLRequest.
app.get('/api/logout', (req, res) => {
const currentUser = getCurrentUser(req);
const user = {
nameID: currentUser.nameID,
nameIDFormat: currentUser.nameIDFormat,
sessionIndex: currentUser.sessionIndex,
};
req.user = user;
return strategy.logout(req, function(err, uri) {
res.redirect(uri);
});
});
app.post('/api/logout/callback', (req, res) => {
req.logout();
// res.redirect(uri);
});
config is set up like this:
const strategy = new SamlStrategy(
{
callbackUrl: process.env.CALLBACK_URL,
entryPoint: process.env.ENTRY_POINT,
issuer: process.env.ISSUER,
logoutUrl: process.env.LOGOUT_URL,
logoutCallbackUrl: process.env.LOGOUT_CALLBACK_URL,
},
strategyCallback,
);
Any help to problem solve the issue is much appreciated.