Hello guys,
I am playing with ionic and angular and I am stuck with http post. After sending post, an error come with
https://api.particle.io/oauth/token 400 (Bad Request)
data: Object
error: "invalid_request"
error_description :"Invalid or missing grant_type parameter"
but it is included.
$scope.getToken = function(){
var config = {
'method': 'POST',
'url': 'https://api.particle.io/oauth/token',
'data':{
'username':'user@gmail.com',
'password':'userpassword',
'grant_type':'password'
},
'headers':{
'Content-Type': 'application/x-www-form-urlencoded'
}
}
$http(config).then(function (response) {
console.log(response);
if (response.data)
console.log(response.data);
}, function (response) {
console.log(response);
});
}
Thank you for help.