3

CORS error when embedding SAP Analytics Cloud story in web page

 1 year ago
source link: https://answers.sap.com/questions/13782331/cors-error-when-embedding-sap-analytics-cloud-stor.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Dec 26, 2022 at 08:23 AM

CORS error when embedding SAP Analytics Cloud story in web page

165 Views Last edit Dec 26, 2022 at 11:20 AM 11 rev

Hello experts,

As shown in the tutorial below, I want to display SAP Analytics Cloud stories embedded in a web page.

Embed an SAP Analytics Cloud Story in a Simple Web App | Tutorials for SAP Developers

However, a problem occurs as follows. Could someone please tell me how to solve this?

Details

After logging in to SAP Analytics Cloud (entering the ID and password) as described in 3 of STEP 3 of the tutorial, I confirmed a timeout error when obtaining an access token. In this case, I ran it on a virtual machine remotely connected from my home PC.(The image below is the command prompt log when a timeout error occurs.)

image.png

Next, I tried it in the local environment of my home PC instead of the virtual machine.

As a result, the timeout error when obtaining an access token after logging in to SAP Analytics Cloud was resolved, but I confirmed that the SAC story was not displayed on the web page after a successful login.

image.png

When I press the "Display Story" button, no story is displayed.

At this time, when I checked the console of the browser (Chrome), the following error message was displayed.

Access to XMLHttpRequest at 'https://<TENANT>/sap/fpa/ui/tenants/<TENANT_ID>/bo/story/<STORY_ID>' from origin 'http://localhost:8081' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

After researching about this error message, I found that I need to add the 'Access-Control-Allow-Origin' header on the server side. However, SAC already allows client-side (local) IP addresses as Trusted Origin.

image.png

IP addresses shaded in blue are those of client-side PCs (my home PCs).

Best Regards,

Takasumi Iwahashi


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK