I’m trying to post to a function from AngularJS, and I keep getting CORS errors. I’ve read the following:
And I haven’t come up with anything useful that I understand. I’m currently trying the following (I also am unclear how to format the data itself):
$http({
url:"https://api.spark.io/v1/devices/<device id>/",
method: "POST",
data: {"color":$color},
withCredentials: true,
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer <authentication code>'
}
})
};