From 7692896441d1b5bb884b3f4298e7bc6ea9c1b7c8 Mon Sep 17 00:00:00 2001 From: pierre-lehnen-rc <55164754+pierre-lehnen-rc@users.noreply.github.com> Date: Wed, 8 Apr 2020 23:18:31 -0300 Subject: [PATCH] [FIX] Random errors on SAML logout (#17227) --- app/meteor-accounts-saml/client/saml_client.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/meteor-accounts-saml/client/saml_client.js b/app/meteor-accounts-saml/client/saml_client.js index 0e4e06d93bd..0c30b46093c 100644 --- a/app/meteor-accounts-saml/client/saml_client.js +++ b/app/meteor-accounts-saml/client/saml_client.js @@ -58,8 +58,12 @@ Meteor.logoutWithSaml = function(options/* , callback*/) { MeteorLogout.apply(Meteor); return; } + + // Remove the userId from the client to prevent calls to the server while the logout is processed. + // If the logout fails, the userId will be reloaded on the resume call + Meteor._localStorage.removeItem(Accounts.USER_ID_KEY); + // A nasty bounce: 'result' has the SAML LogoutRequest but we need a proper 302 to redirected from the server. - // window.location.replace(Meteor.absoluteUrl('_saml/sloRedirect/' + options.provider + '/?redirect='+result)); window.location.replace(Meteor.absoluteUrl(`_saml/sloRedirect/${ options.provider }/?redirect=${ encodeURIComponent(result) }`)); }); };