HI i am using the below method to call a web service from my login page.
var url='url.com'+Username;
$http.defaults.headers.common['Authorization'] = 'Basic ' + Base64.encode(Username + ':' + password);
console.log($http.defaults);
$http({method: 'GET', url: url,headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8','Authorization':'Basic ' + Base64.encode(Username + ':' + password)}}).
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 ');
});
}
else{
//console.log("LOGIvar: " + data+ " - PW: " + password);
console.log(JSON.stringify(data));
$state.go('app.tasklists');
}
// this callback will be called asynchronously
// when the response is available
}).
it working properly. in logout method i deleting the http cookies like
$http.defaults.headers.common['Authorization']='clear';
after that if i enter a wrong password or enter another user i am getting the previously logged i user. is there i am doing any wrong?