cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Consume deployed CAP Service from locally running CAP App

MMarcel
Discoverer
0 Likes
1,422

Hi,

I am working on a CAP Application and the goal is to consume another CAP Application, which is deployed on another Subaccount.

The best Practise Solution to this is to create a Destination on BTP and set up Principal Propagation between the two Applications. (If my research is correct.)

My Problem with this is, that the App I am working on has to be deployed as well for this to work. Otherwise I cannot use the Destination on BTP. So how do I make it possible to use the connection locally while developing the App?

Here are the things I have tried:
Connecting to the Destination in the local development phase. This does not work. The destination cannot be found.

Using a Destination Service and CDS bind to bind to this service. Then I created a Destination within that Service. Unfortunatly the connection to this destination is not possible. Either the destination cannot be found, or the authorization is not possible. I have also tried to bind to an XSUAA instance, to get around the authorization issue. But the Problem with this is, that my User in the App always stays Anonym. So even though I am bound to the instance, I do not seem to get logged in.

Manually implementing the Workflow. This can work. The Problem with this is, that I do not think it is best Practise. Also If I implement it manully for local use and use a destination after the App is deployed, I would have to implement 2 Workflows and decide which one to use based on the deployment status of the app. This cannot be the intended way of doing it.

 

My Question is: What is the intended "Best Practise" Way of resolving this issue?

Thank you so much for your help. 🙂

Accepted Solutions (1)

Accepted Solutions (1)

T1mey
Active Participant

For me it's working to use a destination in local dev. env. 

be sure to bind -2 <dest-service-inst> and <xsuaa-inst>( and maybe conn. service instance)

and 

configure a (development) approuter to authenticate against the xsuaa.

MMarcel
Discoverer

Hi, thanks a lot for the quick answer.

Unfortunatly If I use the approuter, It is not possible to bind it to my application.

So the application still uses the Authorization that is configured in the .cdsrc.json File.

How do I use the approuter for the Authentication?

This is my Approuter:

{
  "routes": [
    {
      "source": "^/(.*)$",
      "target": "$1",
      "destination": "srv-api",
      "csrfProtection": true
    }
  ]
}
 
Thanks a lot for your help! 🙂
MMarcel
Discoverer
0 Likes
The Prolem was that the redirect URL: "http://localhost:<RouterPort>/**", was missing from the xs-security.json.

Answers (0)