Skip to Content
1
Nov 24, 2021 at 12:28 PM

Getting 401 when accessing NodeJS-API from UI5 using BTP destination

447 Views Last edit Dec 07, 2021 at 03:31 PM 4 rev

Hey professionals,

im struggling with authorization on SAP BTP when calling a self-build API from UI5 using BTP destinations. I have following destination:

ohne-titel-2.png

The destination is linked to a API service I build in NodeJS and deployed to CF to send a crypted version of the logged in user. Checking the connection it already says 401, but this happened with every configuration I tried and my thought was forwardingAuthToken should do its part when called from a UI5 application for instance.

See the small extract from my Node service. Isolated this service works perfectly fine and delivers the expected result when asked (i spared out some logic lines, so dont worry about its functionality).

ohne-titel-3.png

My problem comes from the UI5 application where I try to get information from this service.

sUrl is a build url from my application and gets routed though SAP managed by approuter to my destination (the routing itself works fine).

ohne-titel-4.png

The UI5 app is a managed-by application - so i inserted into xs-app.json the necessary configurations.

ohne-titel-5.png

The ajax call itself connects right to the service, but fails with the response HTML Error 401 - Unauthorized. How should i configure the Destination in SAP BTP right or what credentials do I have to use in my ajax call to get this scenario running.

Im really looking forward to your help.

Best regards,

Marc

Attachments

ohne-titel-2.png (172.5 kB)
ohne-titel-3.png (97.8 kB)
ohne-titel-3.png (97.8 kB)
ohne-titel-4.png (74.4 kB)
ohne-titel-5.png (40.6 kB)