Page 1 of 1

External access through the REST urls

PostPosted: Tue Mar 10, 2015 3:18 pm
by FleshFear
Hi.

This is properly been asked before, but I'm not entirely sure what to search on.

But I'm trying to make my own web app or maybe mobile app, to control my indigo server. But using the REST url api.

But I'm not sure how get through the password protection. and getting access. Is there some one how tried this before, and can give me some hints.

I have tried this, but i didn't work. A simple html file on another server on the network.

Code: Select all
<script type="text/javascript">
       
            function load(Test) {
               
                var username = "username";
                var password = "password";
   
                $.ajax({
                    type: 'GET',
                    // TO DO
                    url:  'http://SERVERIP:8176/devices',
                    dataType: 'jsonp',
                    beforeSend: function (xhr) {
                        xhr.setRequestHeader ("Authorization", "Basic " + btoa(username + ":" + password));
                    },
                    success: function(data) {

                        alert("sork");
                    }
                });

            }
       
        </script>
 

        <a class="editLink" onclick="load('Test');">test af link</a>


Hopes some one i willing to help

Re: External access through the REST urls

PostPosted: Tue Mar 10, 2015 8:38 pm
by jay (support)
Indigo uses Digest Authentication (not Basic). One user found a solution though I suspect there is a more native way of doing Digest Authentication in JavaScript.

Re: External access through the REST urls

PostPosted: Wed Mar 11, 2015 2:19 am
by FleshFear
jay (support) wrote:
Indigo uses Digest Authentication (not Basic). One user found a solution though I suspect there is a more native way of doing Digest Authentication in JavaScript.


Thank you i'll looke into that.

but what about manipulating the links.

because that code i wrote will return a "SyntaxError: Unexpected token ':'. Parse error."

and if i modifie the code to dataType: 'json', will return Origin SERVERIP is not allowed by Access-Control-Allow-Origin. That i have fixed by putting Access-Control-Allow-Origin * into the indigo.py. but that returns a new error.