We have moved to a new Sailfish OS Forum. Please start new discussions there.

Revision history [back]

click to hide/show revision 1
initial version

posted 2014-02-13 21:23:39 +0200

QML Image.source authentication

I am trying to get an image from a web-page, but to access it it requires user authentication. To do via XMLHttpRequest() I used the code:

    var httpReq = new XMLHttpRequest()
    var url = "http://" + ip + ":" + port + "/requests/status.xml";

    httpReq.open("GET", url, true);

    // Send the proper header information along with the request
    httpReq.setRequestHeader("Authorization", "Basic " + Qt.btoa(username + ":" + password));

but that only works for XML data, I can access the image by using:

art.source = "http://" + username + ":" + password + "@" + ip + ":" + port + "/art?item="

The problem is that password is passed as plain text.

How would I go make it work without passing the password as plain text?

QML Image.source authentication

I am trying to get an image from a web-page, but to access it it requires user authentication. To do via XMLHttpRequest() I used the code:

    var httpReq = new XMLHttpRequest()
    var url = "http://" + ip + ":" + port + "/requests/status.xml";

    httpReq.open("GET", url, true);

    // Send the proper header information along with the request
    httpReq.setRequestHeader("Authorization", "Basic " + Qt.btoa(username + ":" + password));

but that only works for XML data, I can access the image by using:

art.source = "http://" + username + ":" + password + "@" + ip + ":" + port + "/art?item="
"/art?item=" ;

The problem is that password is passed as plain text.

How would I go make it work without passing the password as plain text?

QML Image.source authentication

I am trying to get an image from a web-page, but to access it it requires user authentication. To do via XMLHttpRequest() get xml information I used the code:use XMLHttpRequest():

    var httpReq = new XMLHttpRequest()
    var url = "http://" + ip + ":" + port + "/requests/status.xml";

    httpReq.open("GET", url, true);

    // Send the proper header information along with the request
    httpReq.setRequestHeader("Authorization", "Basic " + Qt.btoa(username + ":" + password));

but that only works for XML data, I can access the image by using:

art.source = "http://" + username + ":" + password + "@" + ip + ":" + port + "/art?item=" ;

The problem is that password is passed as plain text.

How would I go make it work without passing the password as plain text?