Skip to Content

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

How to clear the cookie in mobile application when click on logout button?


I have done one mobile application using SAPUI5 and Gateway service. In that application I have login page. First time when I send the request with wrong credentials  it goes to error function and displaying some error message. second time when I enter valid credentials it goes to success function and connected with back end and I can get the records.

But my problem is third time when I again enter into the application with wrong credentials, it doesn't goes to the error function.It directly goes to the success function and I am getting data from back end.

I used the below code to send the username and password to the back end.

logindialog.setRightButton(new sap.m.Button({

                              text: "Ok",

                              type: "Accept",

                        tap: function(oEvent) {

                                  username = usernameinput.getValue();

                                  password = pwdinput.getValue();

                                  encrypted = btoa(''+username+':'+password+'');


requestUri : "$format=json",

headers : {

   Authorization : "Basic "+ encrypted


}, function(data) {



var myapp = sap.ui.jsview("view.App");



}, function(err) {


window.alert("Authentication Failed");





I am guessing that the username and password values are stored in cookies.

How can I find those fields and remove those values from cookies in mobile when click on logout button?

Please help me to solve this issue.



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