Search code examples
javascriptsap-cloud-platformcsrf-tokensap-cloud-sdk

SAP Cloud SDK JavaScript: No CSRF Token for onPremise destination with Location ID


I have an application on SAP Cloud Platform which uses the SAP Cloud SDK JavaScript (Version 1.11.3) to communicate with an OnPremise Destination with corresponding Cloud Connector. Requests work fine when the property "Location ID" is empty on both the Destination and the Cloud Connector.

However, when specifying a value for the Location ID (both on Destination and Cloud Connector) only GET requets work.

Other requets (e.g. PATCH, POST) fail with the following error message:

ERR Destination did not return a CSRF token.
This may cause a failure when sending the OData request.
ERR CSRF header response does not include cookies.
...
ERR Error: Create request failed!
...
ERR Caused by:
ERR Error: post request failed!
...
ERR Caused by:
ERR Error: Request failed with status code 403

This did not occur when working with the SAP Cloud SDK for Java.

Am I missing something? Should I set the "x-csrf-token" header manually?


Solution

  • This was a bug in the SDK and was fixed in version 1.13.1.