Click here to Skip to main content
15,867,835 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi
I have an excel macro with Rest API, the first time it works fine but the second time it sends "403 CSRF Token" error. Do you have any ideas how I can solve this?
With objRequest
   .Open "POST", strUrl, False
   .setRequestHeader "Authorization", "Basic My_utorization_code=="
   .setRequestHeader "Content-Type", "application/json"
   .Send Body
   While objRequest.readyState <> 4
      DoEvents
   Wend
   strResponse = .ResponseText
 End With
MsgBox "Respuesta " & strResponse


What I have tried:

I tried adding other "No cache, no store, maxage" statements, but the problem continues
Posted
Comments
CHill60 18-Nov-20 13:15pm    
You haven't given us enough information to help you, such as what is the url, what is in Body.
Have you tried debugging this to see what is going on?
Norma Cruz 18-Nov-20 19:10pm    
Thanks for answering
It is a macro I made to generate tikcets when certain emails arrive.
My url is this strUrl = "http://160.118.117.80:8080/oo/rest/executions"
the process works fine the first time but in subsequent times it sends the error "403 - Invalid CSRF token" null "was found on the request parameter" _csrf "or header X-CSRF-TOKEN". I close the outlook and run again it works the first time

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900