I am unable to request login authentication from URL via payload in AngularJS
Code below works just fine,
$http({
method: 'POST',
url: URL + '&user=' + $scope.vModel.username + '&password=' + $scope.vModel.password,
headers: { 'Access-Control-Allow-Origin': '*' }
})
.then(function(response){})
However since passing user credentials in URL is not a good practice I checked: angularjs $http.post with parameters
But my code for the same authenticate URL is not working as per below code:
$http({
method: 'POST',
url: url,
data: {
user: $scope.vModel.username,
password: $scope.vModel.password
},
headers: { 'Access-Control-Allow-Origin': '*' }
})
.then(function(response){})
What am I doing wrong here?
您向Access-Control-Allow-Origin提出了请求,但没有检查服务是否正常工作和/或此服务允许您进行请求。
After Escalating to cyber security I finally got the answer This endpoint service can be used by their web page which accepts input username and password and gives a session token in response which then can be used to access data from servers.
Now I need to figure out if my angular code can catch the response from their web page so that I can get session token
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.