cancel
Showing results for 
Search instead for 
Did you mean: 

Access to html basic protected image via SapUI5 & Cordova

0 Kudos

Heya

I'm trying to access an image protected by a simple http basic authentication mechanism. This example works fine when using my browser

...

var mImage = sap.m.Image("Im1");

mImage.setSrc("http://user:password@192.168.0.100/image.jpg");

...

var page = new sap.m.Page({
title: "Image",
content:
          mImage
        
}

Yet when I wrap it in a Cordova container (Android) this simple way of attaching user+pw does not seem to work. The webserver responds with a 401 error and my app does not send an authentication header.

Any suggestions on how I could tackle this issue?

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

After some digging around this seems to be the result of a bug in Androids WebView - Authentication challenges are not handled properly.

There are three solutions:

  • Use Android 5.0 where the bug was fixed and the above solution works.
  • Use the Kapsel Proxy plugin.
  • Use the XmlHttp response and do some hacky stuff with the response. Best would be to have the server respond with a Base64 encoded stream. Then take this stream and convert it back to an image.

Answers (0)