Home/Support/Support Forum/XMLHttpRequest from javascript to device cloud is denied
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

XMLHttpRequest from javascript to device cloud is denied

0 votes
Hi,
my HTTP request from javascript towards the device cloud is not working. If I use the URL field or a java application it all works fine. A snapshot of my code:

var xhr = new XMLHttpRequest();
xhr.open('GET', "https://devicecloud.digi.com/ws/AlarmStatus", true);

xhr.withCredentials = true;
xhr.setRequestHeader("Authorization", "Basic "+encodeduserpass);
xhr.send(null);

The response is as given below. Does this mean that javascript is not supported by the device cloud? Or that my subscription doesn't support it? I've tried many different settings in Chrome and the code for cross domain requests, but without luck. Any help would be very helpful. Thanks


XMLHttpRequest cannot load https://devicecloud.digi.com/ws/AlarmStatus. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://xxxxxxxx' is therefore not allowed access. The response had HTTP status code 401.
asked Dec 13, 2016 in Web Services by jrherheim New to the Community (4 points)
recategorized Dec 14, 2016 by LeonidM

Please log in or register to answer this question.

...