How is it possible to query the rest service via myopenhab.org.
I have tried it this way.
<script>
var username="xxx";
var password="xxxx";
$.ajax({
type: "GET",
url: "https://myopenhab.org/rest/items",
dataType: 'json',
headers: {
"Authorization": "Basic " + btoa(username + ":" + password)
},
success: function (result){
console.log(result)
}
});
</script>
Access to XMLHttpRequest at 'https://myopenhab.org/rest/items' from origin 'http://192.168.XXX.XXX' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
GET https://myopenhab.org/rest net::ERR_FAILED
But always get the cors problem.
When I do the same query via postman. It works fine.