Skip to Content
0
Jun 25, 2019 at 02:03 PM

Logout Not working as expected for Fiori Launchpad

345 Views

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

Attachments

popup.jpg (40.3 kB)
nw-tab.jpg (46.3 kB)