on ‎2018 Jul 05 2:59 AM
I was referring below blog on impementing the logout functionality.
Using the SAP HCP User API in SAP Web IDE
HCP HTML5(UI5) application logout not happening using userapi ?
I'm able to navigate to my logout.html page. However, the logout function does not clear the session and I am still able to access the page when I click the browser back button. Even if I redirect the page to my logon page, it's still being in the authenticated mode and direct access to my main page.
onInit: function() {
// set user model
var userModel = new sap.ui.model.json.JSONModel();
userModel.loadData("/services/userapi/currentUser", null, false); },
onLogout: function(){
$.ajax({
url: "/services/userapi/logout",
method: "POST",
success: function() {
sap.m.URLHelper.redirect("logout.html", false);
}
});
}
Request clarification before answering.
I would suggest you have a look at my project https://github.com/gregorwolf/HTML5UserAPI. The important definition for a working logout is:
"logoutPage": "/webapp/logout.html"
in neo-app.json.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi gregorw,
I tried import your project and tested, it's same results as per my project. It's able to navigate to logout.html. However, when I click browser back button, the page does not re-validate the authorization and the login session is still there. I tried navigate back to index.html and refresh, it does not prompts for login credential. I guess the is session cache there.
How can we achieve something like standard SCP logout behavior? When I click logout from the cloud cockpit and navigate back, it's show below error message instead navigate back to my previous page where my user id is still logon?

Thanks.
Regards,
Ben
You're right that the page is still shown when you click the browser back. But that is due to caching. When you refresh the page or try to access one of the links you're asked to re-authenticate. So what you might check is the response header com.sap.cloud.security.login for your AJAX requests as described in the HTML5 Authenticaiton documentation.
| User | Count |
|---|---|
| 7 | |
| 6 | |
| 6 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.