External access through the REST urls

Posted on
Tue Mar 10, 2015 3:18 pm
FleshFear offline
Posts: 2
Joined: Nov 24, 2014

External access through the REST urls

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
Last edited by FleshFear on Wed Mar 11, 2015 2:19 am, edited 1 time in total.

Posted on
Tue Mar 10, 2015 8:38 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: External access through the REST urls

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.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Mar 11, 2015 2:19 am
FleshFear offline
Posts: 2
Joined: Nov 24, 2014

Re: External access through the REST urls

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.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 6 guests