I am having trouble requesting login authentication from a URL using payload in AngularJS
The code below is functioning properly:
$http({
method: 'POST',
url: URL + '&user=' + $scope.vModel.username + '&password=' + $scope.vModel.password,
headers: { 'Access-Control-Allow-Origin': '*' }
})
.then(function(response){})
However, I am aware that passing user credentials in the URL is not recommended, so I looked into angularjs $http.post with parameters
But when I tried to authenticate using the same URL with the following code, it did not work:
$http({
method: 'POST',
url: url,
data: {
user: $scope.vModel.username,
password: $scope.vModel.password
},
headers: { 'Access-Control-Allow-Origin': '*' }
})
.then(function(response){})
Can someone help me identify what I might be doing wrong here?