Skip to Content
0
Jul 02, 2019 at 03:10 AM

How to use odata get X-CSRF-Token from gateway

13618 Views

Hi All,

I want to use oData to post my data to gateway service, but but it gives error of 403 forbidden.

I searched on google , find the post function must add the X-CSRF-Token on headers.

so i try to get the X-CSRF-Token in my odata read function, but it doesn't work.

Any help / guidance to resolve this would be much appreciated!

  • 1 I have set the default logon user to my ui5 project, use SICF tcode.

  • 2 my odata setting in ui5 project

  • 3 odata read function

i have set "X-CSRF-Token":"Fetch" in headers.

  • 4 my chrome debug view, in response.headers didn't return the token
  • 5 when i use postman to send get request, response headers return token. The difference with ui5project, postman get request have set up a user.

    Attachments

    scif-set.png (50.4 kB)
    odata1.png (6.5 kB)
    odata2.png (9.8 kB)
    odata3.png (33.5 kB)
    odataresponse.png (95.6 kB)
    postman.png (83.3 kB)
    postman1.png (90.9 kB)
    postman.png (83.3 kB)
    postman.png (83.3 kB)