Skip to Content

Ui5 oData Https Basic Auth

Hi Experts,

We are developing an UI5(Fiori Like app) packed with phonegap. We want to set up basic Authentication for the app to connect to the oData provider (its not an SAP backend, just an own provider). But I cant send out the user/pw in the header. even I'm using the following:

var url = "https://urltotheserver";
  var oModel = new sap.ui.model.odata.ODataModel(url, true, "User", "Pw");

Do you have any suggestions? I want to avoid using proxy.

Thanks

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Jan 10, 2015 at 05:21 PM

    Might be due to cross domain issue, if setting in the header as per Dennis suggestion, you might want to try setting the bWithCredentials flag.

    JsDoc Report - SAP UI development Toolkit for HTML5 - API Reference - sap.ui.model.odata.ODataModel

    {boolean}bWithCredentials?(optional, experimental) true when user credentials are to be included in a cross-origin request. Please note that this works only if all requests are asynchronous.
    Add comment
    10|10000 characters needed characters exceeded

  • Jan 10, 2015 at 05:01 PM

    HI David

    Have you try

    oModel = new sap.ui.model.odata.ODataModel(url, true, null, null, {Authorization: "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="});

    where QWxhZGRpbjpvcGVuIHNlc2FtZQ== is encoded username:password string

    Thanks

    -D

    Add comment
    10|10000 characters needed characters exceeded