on 06-25-2019 3:03 PM
Hi Experts,
I have a custom button on click of which I want to logout from Fiori Launchpad, after reading several blogs and answers I implemented it following way :
handleLogout: function() {
$.ajax({
type: "GET",
url: "/sap/public/bc/icf/logoff"//Clear SSO cookies: SAP Provided service to do that
}).done(function(data) { //Now clear the authentication header stored in the browser
if (!document.execCommand("ClearAuthenticationCache")) {
//”ClearAuthenticationCache” will work only for IE. Below code for other browsers
$.ajax({
type: "GET",
url: "/sap/public/bc/icf/logoff", //any URL to a Gateway service
username: "dummy", //dummy credentials: when request fails, will clear the authentication header
password: "dummy",
statusCode: {
401: function() {
//This empty handler function will prevent authentication pop-up in chrome/firefox
}
},
error: function() {
//alert(‘reached error of wrong username password’)
}
});
}
// Reloads page at same location
window.location.replace("/sap/bc/ui5_ui5/ui2/ushell/shells/abap/FioriLaunchpad.html");
});
}
It is Logging out , but I am not able to prevent the authentication pop-up, as per the code it should be handled for status code 401. Problem is I am not getting the status code 401 after done I am getting 403 but putting that in code is not helping.
Secondly the Code :
window.location.replace("/sap/bc/ui5_ui5/ui2/ushell/shells/abap/FioriLaunchpad.html");
is not being called so I am stuck with the screen:
but I want to move to main login screen on top of current screen. Here is the SS of network tab :
I am feeling like the response from server has some problem , Can anyone please teel what is wrong here.
I am using Chrome browser.
Regards
Rakesh
Found solution by delaying the logout call by 500ms.
Regards
Rakesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
77 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.