Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing full articles (6178 articles)
Browse article index
↧

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?

 

Please help. TIA.

 

Regards,

Sumit Jindal

↧

Viewing full articles (6178 articles)
Browse article index

Latest Images

Trending Articles



Latest Images