cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to connect from SAP Fiori to SAP CPI in SAP BAS

Priyanka97
Explorer
0 Kudos
561

Hi,

we have a requirement to get data in fiori application from CPI. We are going to deploy this app on On-Premise system.

while performing Ajax call I'm getting 401 error.

If I double-click on this link, I can can get the data in browser.

Following is my Ajax call in controller

I try adding this URL "https://cors-anywhere.herokuapp.com" with my CPI link but it's not working, here I get 401 Unauthorized error. and if I execute this link in browser I get "Missing required request header. Must specify one of: origin,x-requested-with

Also I add chrome extension for CORS, it is also not working.

Any help would be much appreciated.

Regards,

Priyanka

Accepted Solutions (0)

Answers (1)

Answers (1)

mauriciolauffer
Product and Topic Expert
Product and Topic Expert
0 Kudos

priyanka.punde , as stated in my blog, none of the options are for productive environments. You don't fix CORS issues in the frontend app as the "problem" happens on the backend response.

As you're calling an CPI endpoint, you must enable CORS on CPI itself. Follow the steps on this tutorial, it may help:

Configure SAP API Management policies to avoid CORS issues and generate an API Key