Skip to Content
1
Dec 19, 2022 at 09:31 PM

CAP app consuming another CAP app - error redirecting to login/callback

560 Views Last edit Dec 19, 2022 at 09:36 PM 3 rev

Hi.

I've been moving some applications from on-premise to BTP using CAP.

There's a scenario that I have one CAP app providing some V2/V4 OData endpoints and others CAP apps, UI only, consuming those APIs.

The CAP app that provides the OData APIs, provides a destination service instance where others apps can use it to fetch data.

Architecture is something like this:

image.png

Destination code created from MTA:
The destination URL is the App Router (1) URL.
image.png
Deployed it creates this.

image.png

Running App router (1)

image.png

I'm facing an issue when consuming that destination in the Fiori apps or any other app that consumes the API. For the Fiori applications, in MTA file, I've bound the destination service and using it in the App Router (2) module:
image.png


App Router (2) XS-APP file
image.png

Running the App Router (2) using the Welcome File routing to the odata endpoint ( /v2/catalog/ = app router 1), it returns all odata endpoint, metadata, etc...
Doing this way, destination works fine.

image.png

Changing the welcomeFile to the app router (2) starts running the index.html of the Fiori application, destination does not work. I'm not sure if the problem is the destination or a kind of authentication.
Fiori manifest file is ok.

image.png

The odata call /v2/catalog returns the OAuth Login screen.

image.png

This is the return from the app router (1):


<html>
   <head>
      <link rel="shortcut icon" href="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" />
      <script>document.cookie="fragmentAfterLogin="+encodeURIComponent(location.hash)+";path=/";document.cookie="locationAfterLogin="+encodeURIComponent(location.href.split('#')[0].split(location.host)[1])+";path=/";document.cookie="signature=gKVMB7XRy4gEINkGMBzOGNXtIqw%3D;path=/";location="https://something.authentication.eu10.hana.ondemand.com/oauth/authorize?response_type=code&client_id=sb-cux-api!t136841&redirect_uri=https%3A%2F%2Fport5000-workspaces-ws-something.eu10.applicationstudio.cloud.sap%2Flogin%2Fcallback"</script>
   </head>
</html>

I'm not sure what's happening if the problem is something in the destination or the app router (2) it's not forwarding the token to the app router (1).

Could you please help me?

Thanks and regards,
Guilherme

Attachments

image.png (35.5 kB)
image.png (46.2 kB)
image.png (68.6 kB)
image.png (23.5 kB)
image.png (77.7 kB)
image.png (53.9 kB)
image.png (33.1 kB)
image.png (78.2 kB)
image.png (30.9 kB)
image.png (31.6 kB)