cancel
Showing results for 
Search instead for 
Did you mean: 

Expose NodeJS app with SAP Cloud Connector and Cloud Foundry

ferrygun18
Contributor
0 Kudos

Hi,

I am following this blog https://developers.sap.com/tutorials/cp-connectivity-consume-odata-service-approuter.html to expose the NodeJS app on-premise to outside world with SAP Cloud Connector and SAP Cloud Foundry.

Instead of using ABAP backend, I am using a simple REST NodeJS App. Would it be possible to expose to outside ? I have following the blog, but it was not successful. Thanks

Ferry

Badhusha
Participant
0 Kudos

Hi Ferry,

I am also following the same tutorial you have mentioned, but I am not able to proceed after the login screen. It is loading-reloading, continuously. I am using the destinations in Cloud Foundry which is reachable. The destination points to the ABAP Backend (SEGW).

Do you have any idea what I should do? Can you please help me with this ?

Accepted Solutions (0)

Answers (3)

Answers (3)

0 Kudos

Are you using passport to verify jwt sent from app router in your node.js app?

if so then you need to remove it if you don't want authentication and also in appRouter xs-app.json set authentication method to none for the node.js destination

ferrygun18
Contributor
0 Kudos

Hi Ivan,


Thanks again for detailed explanation. I got it working now with your guideline.

I have one question here on the authorization.

When I perform a webhook call to the app URL http://appnode-demo-pxxxxxtrial.cfapps.eu10.hana.ondemand.com,

I got unauthorized error message when performing the request from SAP Conversational AI Webhook call or Postman. If I open from browser and enter my ID and pwd, it works fine.

I also tried with clientid, clientsecret, url from xsuaa VCAP_SERVICES without luck.

Is there any setup that was missing from XSUAA instance? and what the authentication type should be?

Regards
Ferry

ferrygun18
Contributor

I set the authentication to basic and it is working perfectly.

My other question how to make it as public access (no authentication) ?

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Ferry,

I got a little confused on what you doubt is.

Just to make sure I understand you correctly, let me start by saying that any application published on your cloud platform account will have its own publicly URL identifier. Thus, all cloud applications are in essence public. The AppRouter is basically a NodeJS application with SAP's implementation required to perform SSO authentication between other microservices. In other words, AppRouter will be responsible for picking-up the JWT and sharing it internally with other microservices.

So, the tutorial show you how to deploy the web application (AppRouter) and integrate it with the connectivity service (destination) forwarding the JWT so you do not need to perform authentication to it again. Once the web application is able to "talk" with the connectivity service it would forward the request to the "connected" Cloud Connector so it calls the local/on-premise system. In the tutorial it marks the destination with user id/password, but in the real world you would want to look into Principal Propagation. This setup would allow you to "map" cloud users to ABAP users.

Now, if the doubt is on how to expose the ABAP OData service to the cloud, you would need to first deploy a Cloud Connector in your on-premise landscape. Once that is done, you can register a virtual hostname to a real hostname there in such a way that the destination refers to that virtual host.

Hope this helps!

Best regards,
Ivan