I'm trying to use the cloudapp api with javascript, the problem is that the api is using Digest access authentication for authentication. I visited the app documentation but there is no examples or wrappers for javascript. I tried many things but here is my latest code:
$.ajax({
headers: { "Accept": "application/json"},
type: "GET",
url: "http://my.cl.ly/account",
crossDomain: true,
success:function(data, textStatus, request){
console.log(data);
}
});
All I'm getting with this code is Cross-origin resource sharing (CORS) problems and a 401 Unauthorized error. here is the response headers:
Cache-Control no-cache
Connection keep-alive
Content-Type text/plain; charset=utf-8
Date Wed, 17 Sep 2014 20:15:26 GMT
Transfer-Encoding chunked
WWW-Authenticate Digest realm="Application", qop="auth", algorithm=MD5, nonce="MTQxMDk4NDkyNjo4MmE4ZWU0ZDY4YWUwYTAyMjRjNzIzYWU2NzE5YTQyMQ==", opaque="9eb56ccb2e8b017ae42bdb4739690863"
X-Request-Id b6bdbf12-f1d9-4769-a06d-216d5d7ae669
X-Runtime 0.008105
status 401 Unauthorized
x-ua-compatible IE=Edge,chrome=1
So how can I use the WWW-Authenticate to authenticate and retrieve data?
Also I tried adding
xhrFields: {
withCredentials: true
}
I got a promt, I filled it and now I'm getting 200 OK status but no response. All I need is to get this working and getting a return. Thanks.