Skip to Content
avatar image
Former Member

about request, response and X-CSRF token

hello experts,

can someone explain about request, response and X-CSRF token in UI5 while connecting from eclipse to back end for create, update and delete operations.

thank you.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 23, 2015 at 06:16 AM

    Hi Phanindra,

    you will need the X-CSRF-Token to send it in the headers of a POST/PUT HTTP Request.

    To get it from backend, simply call a GET HTTP method with a header X-CSRF-Token:Fetch, and you will receive in the response a header which looks like x-csrf-token:ad8a7asdsn8sa==

    You need to put this token in all the headers of a modifying operation, POST for an example.

    It's a security mechanism from the backend. If you're not authenticated properly you won't be able to fetch the CSRF token.

    Hope this helps

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 23, 2015 at 06:11 AM

    Hi Phanindra,

    Request:

    1.To trigger/get information from user to database

    Flow:

    UserScreen ----> Gateway Service ----->ECC

    1. var oDATAServiceURL = "http://server/ias_relay_server/client/rs_client.dll/ODATAFARM/sap/opu/odata/sap/Z_OURSERVICE"; 
    2. var oDATAServiceUserName = "NetWeaverGatewayUserID"; 
    3. var oDATAServicePassword = "PasswordOfNetWeaverGatewayUserID"; 
    4. var myODATAModel = new sap.ui.model.odata.ODataModel(oDATAServiceURL, false, oDATAServiceUserName, oDAT)



    Response:


    It returns your required information under success call back function



    X-CSRF:


    While creating/updating the records. we want csrf-token.


    How to fetch X-CSRF-Token | SCN


    Thanks,

    Karthik A

    Add comment
    10|10000 characters needed characters exceeded