SAP Connector create results in Error CSRF Token. - Mendix Forum

SAP Connector create results in Error CSRF Token.

0

Hi,

I want to use the SAP ODataConnector for my app. For the get list function, I get a response. But, when I want to create an object and send it to SAP I get the following error:

sapodataconnector.utils.ODataResponseException

CREATE|Response code: 403, Response text: CSRF token validation failed

I understand I have to create a header with the CSRF token and put that in the Request Parameters, but after I tried that in multiple ways, I still get this error. Would be great if someone could help me with this :) 

Thanks!

asked
1 answers
2

Hi Jacob, this is correct the create action requires a CSRF token.

Before doing the create action you can obtain a list of CSRF tokens from your session object.

Retrieve the list over association and use the list operation Head to obtain the last one. If no token exists, call the get list operation and check again afterwards.

answered