Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to use user API logoff in HCP HTML5 application?

Hi all,

SAP HANA Cloud Platform Docu for user API mentions a logout function. How should I exactly use this? Make a ajax oder OData read request to /userapi/logout ? Redirect the browser to /userapi/logout ?

Thanks for any hints,

Wolfgang

Tags:
Former Member
replied

Hi Wolfgang,

when you have made the settings in the neo-app.json file ...

e.g.

        "path": "/services/userapi",

        "target": {

           "type": "service",

           "name": "userapi"

        },

        "description": "UserAPI"

you can do an ajax call for the logout service.

Here is an example calling the logout service for the above service definition within a function called when a button is pressed (the function calls the service and navigates to a "logged out" page after successful service call).

  onPressButton: function() {

      $.ajax(

          {

              "url":"/services/userapi/logout",

              "success": function(){ sap.ui.getCore().byId("idApp1").to("idView2"); }

             

          });

  }

In the browsers developer tools you can see on the network tab if the call was successful.

Best regards,

Florian

2 View this answer in context
Not what you were looking for? View more on this topic or Ask a question