title: logout of Idp session with passport-saml
body: <p>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.</p>
  
  <p>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.</p>
  
  <pre><code>app.get('/api/logout', (req, res) =&gt; {
    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) =&gt; {
    req.logout();
    // res.redirect(uri);
  });
  </code></pre>
  
  <p>config is set up like this: </p>
  
  <pre><code>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,
  );
  </code></pre>
  
  <p>Any help to problem solve the issue is much appreciated.</p>