i am using a web service having basic authentication i.e. below code shows how i calling the web service
var url='http:url.com/;
$http.defaults.headers.common['Authorization'] = 'Basic ' + Base64.encode(Username + ':' + password);
$http({method: 'GET', url: url}).
success(function(data) {
if(data=='' || data==null || data=='undefined'){
var alertPopup = $ionicPopup.alert({
title: 'Info!',
template: 'Invalid Password, or no user found with this Email Address'
});
alertPopup.then(function(res) {
console.log('Invalid Password, or no user found with this Email Address ');
});
return false;
}
else{
var favoriteCookie = $cookies['JSESSIONID'];
window.localStorage['data'] = JSON.stringify(data);
//console.log("LOGIvar: " + data+ " - PW: " + password);
console.log(data);
$state.go('app.tasklists');
return false;
}
}).
i am getting the correct response and all working fine. But when i logout the app i am using the below code
$cookieStore.remove('JSESSIONID');
$cookieStore.remove('JSESSIONIDSSO');
$http.defaults.headers.common['Authorization']='undefind';
$scope.modal.show();
$state.go('login',{}, {reload: true});
the real problem is when i logedout then try to logged in with incorrect password it getting logged in web service retuning the previous user details.how can i fix this one thanks in advance?
Just to answer your question:
remove cookies and header, then it asks for re-authentication and also clear native application then it is working fine