cancel
Showing results for 
Search instead for 
Did you mean: 

Connect to gateway in sap cap node.js

0 Kudos

Hi,

I am trying to make a post to gateway but I need to receive the X-CSRF-TOKEN token. Before making the post, I make a get with the header to receive some data and the X-CSRF-TOKEN, but I don't get any header.

I am receiving the call data correctly but I am not receiving the headers.

const destGw = await cds.connect.to("SAPGateway");
let result = await destGw.tx(req).get("/sap/opu/odata/sap/ZGW_DATA_XXXXXXX/XXXXXXXSet", {
"Access-Control-Allow-Origin": "*",
"X-CSRF-TOKEN": "Fetch"
});

Are the headers in the get sent that way? Would anyone know what could be wrong?

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

gregorw
Active Contributor
0 Kudos

Please check CSRF-Token Handling