I am trying to make a simple POST
request for sign in but it doesn't work. I read this thread (AngularJs $http.post() does not send data) and tried almost every suggestion but nothing works. Here is my code:
$http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8';
$http({
"async": true,
"crossDomain": true,
"url": "https://myurl/api_v1/login/json",
"method": "POST",
"headers": {"Content-Type": "application/x-www-form-urlencoded"},
data: {
"username": "admin@admin.adm",
"password": "admin"
}
}).then(function successCallback(response) {
console.log(response);
}, function errorCallback(response) {
alert(response);
});