How to work with cookies using the HTTP Request service layer

Hello,

Can anyone help me with how can set the cookies to a HTTP Request function.
The first HTTP request is service layer login. So I wanted to get the cookies from the service layer login HTTP request passing to the second HTTP request to get the data for a specific endpoint.

A cookie is a header. You can refer to my past answers in this forum here: Search results for 'cookies' - AppGyver

and more specifically here: CSRF Token Validation - Appgyver to SAP S/4 - #8 by Piotr_Tesny

Thank you for the reply @Piotr_Tesny. After trying on the link that you provided I got a different error which is - TypeError: Failed to fetch. Does the server allow CORS?. Hope you can help me with this also. thank you

I think you may have mis-red me: the point is is that one cannot use server side cookies in java script in a browser.

Re the error you reported. It is related to CORS policy settings that your API must implement as to meet browsers CORS requirements.

There is not much you can do about it in Appgyver - if what you are doing is generating web apps.
For instance, you might want to implement your API as a proxy outside of Appgyver using any CORS compliant framework and then use the API proxy in AG. I hope that helps.

PS. How to Solve CORS Issues with SAP API Management - #15 by hben_red

1 Like