CSRF token in REST message

Vanit
Mega Contributor

HI,

 

We are trying to retrieve the CSRF token from the REST endpoint in servicenow dublin patch6 release.

 

CSRF token is being sent when we pass the parameter fetch in the POST man by passing the parameter "x-csrf-token" :"Fetch".

 

But I passed the same header in Servicenow its not sending me CSRF token in the response. Can anyone guide me to retrieve this.

 

Thanks & Regards

Vani

3 REPLIES 3

kevinme
Mega Contributor

Hi Vani



Were you able to find a solution for this problem?



Kevin


Vanit
Mega Contributor

Hi,



No. we are still searching for solution. Could you please guide us on this.



Regards,


Vani Talluri


+61407305002


kevinme
Mega Contributor

Hi



I found out, that a new user token is returned in the response header if an incorrect token is sent with the request. This is visible in Chrome Developer tools or something similar. The problem is, that this header is not accessible by script...or at least I don't know how. I guess the problem is, that this is not allowed (Access-Control-Allow-Headers).



HTTP access control (CORS) - HTTP | MDN



Maybe you find a solution



Kevin