Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Access to html basic protected image via SapUI5 & Cordova

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?

Tags:
Former Member
Former Member replied

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.
0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question