Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3548

Problem in fetching X-CSRF-Token

$
0
0

Hi All,

 

I am trying to perform the CRUD operations on an entity. After going through web, i came to know that for performing any modification operation, we need to have the CSRF token mandatorily.

 

So, for the same i tried to trigger a GET request to fetch the CSRF token. Now, to achieve that i tried to set the model header as below:

 

oModel.setHeaders(

                 {

"X-Requested-With": "XMLHttpRequest",

                     "Content-Type": "application/atom+xml",

                     "DataServiceVersion": "2.0",    

                     "X-CSRF-Token": "Fetch"

                 });

 

With the above code i try to get the CSRF token from the GET request but unfortunately the response doesnt hold the CSRF token.

 

Upon further analysis by debugging, i found that the above code is setting all the attributes other than the X-CSRF-Token in the model's custom header object. So, i think that could be the reason for not bringing the CSRF token but i am unable to understand by the above code is not setting the X-CSRF-Token inside the header?

 

Also, please note that i tested the service using postman client & it brought the CSRF token, so i assume that there is no issue with the service.

 

Please help. TIA.

 

Regards,

Sumit Jindal


Viewing all articles
Browse latest Browse all 3548

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>