Skip to Content
avatar image
Former Member

HCP HTML5(UI5) application logout not happening using userapi ?

I have configured following in neo-app.json

...
"routes": [
   {
     "path": "/services/userapi", 
     "target": {
       "type": "service",
       "name": "userapi"
     }
  }
]
...

Then I am trying to logout service call on a button press as given below,

$.ajax({
      "url": "/services/userapi/logout",
      "success": function() {
	    window.location.replace("http://www.abcd.com");
      }
});

Once this ajax call completed I can see the following message in browser network tab,

preview :

Note : I am not able to do logout functionality from the application but however if I am opening the same logout request url in new tab the logout happens successfully.

Am I missing some configuration ?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Aug 08, 2017 at 10:46 AM

    Hi,

    Finally I figured it out, please follow the below process for logout functionality in IDP configured application:

    In neo-app.json ("logoutPage": "/logout.html",)

    ...
    {
       "welcomeFile": "/index.html",
       "logoutPage": "/logout.html",
       "authenticationMethod": 
       "saml","routes": [{
    ...  


    When logout event handler trigger : ie. on Button press event :

    sap.m.URLHelper.redirect("logout.html", false);

    Create a .html file in your root directory of your application (logout.html):

    <!DOCTYPE HTML>
    <html lang="en-US">
        <head>
            <meta charset="UTF-8">
            <meta http-equiv="refresh" content="1; url=https:<url to the application>">
            <script type="text/javascript">
                window.location.href = "url=https:<url to the application>"
            </script>
            <title>Page Redirection</title>
        </head>
       <!-- <body>
            <!-- Note: don't tell people to `click` the link, just tell them that it is a link. -->
            Logging out.......
            <br><br>
            If you are not redirected automatically, follow this <a href='<url to the application>'>link</a>.
        </body> -->
    </html>
    
    Add comment
    10|10000 characters needed characters exceeded