Skip to Content

HANA XS JavaScript Destination with base authentication

Hi there,

I am searching for an example on the Web which explains me how to use XS JS HTTP Destinations with a URL that has authentication set to "base" and needs to access the content from a url which can only be access by username and password.

The configuration syntax of .xshttpdest Files is linked here: https://help.sap.com/saphelp_hanaplatform/helpdata/en/6e/fe500d91ee462c85cce7609646e17a/frameset.htm

All the public examples like e.g. https://help.hana.ondemand.com/help/frameset.htm?06ca24043b0f4eb78cf39c6bc1d8a8dc.html show only the easy cases with "authType=none" and I never found an example with "authType=basic".

The JavaScript API for HANA XS is not so extensive and hence I have my problems in setting HTTP request headers in JavaScript:

http://help.sap.com/hana/SAP_HANA_XS_JavaScript_API_Reference_en/$.net.Destination.html

I would like to write something similar to

req.headers.set("Authentication", "Basic " + base64_encode("USER:PASSWORD")) but I didn't find any example yet for this and my trials won't work. Can someone support here which is more experienced with HANA XS Destinations?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Jan 31, 2017 at 04:00 PM

    Hi Andreas!

    You can configure the .xshttpdest with basic authentication by setting authType = basic; in the file.

    What you need to do then in addition is to configure the username and password for this destination using the XS Admin Tool (<server:port>/sap/hana/xs/admin). You navigate to your .xshttpdest file and provide the credentials there.

    Afterwards, the server takes care of authentication with the stored credentials when you use the destination with the $.net API.

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 31, 2017 at 02:38 PM

    Hi,

    you can configure authentication details in xshttpdest file directly, you can simply try with following steps.

    • go to xs admin page , https://hanahost:port/sap/hana/xs/admin
    • open your .xshttpdest file from application objects tab.
    • go to Authentication detail section and try to enter user credentials.
    • don't try to upload target service certificate in trust manager.

    Please find attached screenshot for reference.dest.png

    Regards,

    Harish

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 31, 2017 at 07:06 PM

    Issue solved! This is a bug in the Chrome browser. It works in IE.

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 31, 2017 at 05:16 PM

    Hi Jonas, Harish

    thank you both for the remarks. I was able to view the XS Admin Tool and the corresponding .xshttpdest file; however now I have the problem that only the first tab "General Information" is editable, but not "Proxy Details", "Authentication Details" and "OAuth Details". Am I missing some additional HANA Privileges?

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello Andreas Morf,

      I have the similar issue while opening "Proxy Details", "Authentication Details" and "OAuth details-
      were you able to solve this??can i know what is the issue.
      Thanks in advance