I am developing a ui5 app using the managed app router to try to consume destinations from the BTP. The destination uses a BasicAuthentication with a technical username and password and the connection works but when I am trying to access the data from my UI5 app I get a 401 Unauthorized response code.
In the xs-app.json of my app is the authenticationType xsuaa. I can provide some file and snippets if this helps.
Does anyone have an idea what the problem is? Thanks for your help.
yes, you need to have your SAPUI5 app send the HTTP Authentication header in the request. You can use Chrome DevTools to see that HTTP header; it should have the name 'Authorization' followed by a 'Basic' + basic64 cipher. (exemple here How to hide the basic authorization credential in browser response header? )
About Basic Auth : https://learn.microsoft.com/en-US/aspnet/web-api/overview/security/basic-authentication
Instead of setting directly that HTTTP header (with username/password) in your app, I'd recommend to use your server authentication default process.