cloud-cap-samples-java icon indicating copy to clipboard operation
cloud-cap-samples-java copied to clipboard

Login pop-up is not shown when starting the Fiori application

Open zdravko-georgiev opened this issue 1 year ago • 1 comments

Hello CAP experts, I used this CAP Java project and generated inside of it a Fiori elements List Report application. The application is called authors Now I want to use a slightly different approach to run the Fiori application in the browser. What I do is the following:

  1. I am executing mvn spring-boot: run in the root folder of the CAP project, build is successful and the Tomcat server is started on localhost:8080
  2. In a new terminal, I am navigating to the root folder of the Fiori application /app/authors and executing npm start. This starts an express server with a proxy middleware on localhost:8081. The proxy middleware will forward any backend requests to the Tomcat server on localhost:8080
  3. But now when open http://localhost:8081/test/flpSandbox.html?sap-ui-xx-viewCache=false#authors-tile, I immediately get a 401 Error

image

I noticed that if I open the application from the Tomcat server, hence opening http://localhost:8080/authors/webapp/test/flpSandbox.html?sap-ui-xx-viewCache=false#authors-tile in the browser, the first thing that I get is the login pop-up.

image

Could you please advise on how to resolve the issue?

zdravko-georgiev avatar Sep 01 '22 10:09 zdravko-georgiev

Attaching my project cap-java-ux-ui5-tooling-example.zip

zdravko-georgiev avatar Sep 01 '22 11:09 zdravko-georgiev

Hi, this is due to the behaviour of your express app that you start manually. It doesn't know anything about the required authentication on CAP Java server-side. You either need to configure a hard-coded basic authentication in your server URL that you configure on your express application or you need to implement basic authentication in your express app and forward it to the backend.

In case you start the Spring Boot server and have the UI resources served by it, everything works out-of-the-box as the UI is authorized on the same URL as the server APIs and thus the browser can correctly handle the basic authentication for you.

beckermarc avatar Oct 26 '22 12:10 beckermarc