cancel
Showing results for 
Search instead for 
Did you mean: 

Getting X-CSRF-Token from response header in SAPUI5

Former Member
0 Kudos

Hi all, I am able to get X-CSRF-Token using advanced rest client but was not able to get token from the response header in SAPUI5.This is the code I am using

OData.request

  ({ 

  requestUri:  "http://localhost8080/gateway/odata/sap/ArticleService;v=1", 

  method: "GET", 

  headers: 

  {       

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

  "X-CSRF-Token":"Fetch"                                 }                   

  }, 

  function (data, response)

  {

  header_xcsrf_token = response.headers['x-csrf-token'];

  alert(header_xcsrf_token);

I am getting undefined in the header,any comments/suggestions are highly appreciated
Best Regards

Sarosh Bilal

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I also tried to hard code the value of X-CSRF-Token in post method (which I got from advanced rest client) but it gave me 403 Forbidden error.