graphiomaniac
New Member
- Joined
- Nov 5, 2020
- Messages
- 1
- Office Version
- 365
- Platform
- Windows
Hi Experts,
I am trying to fetch x-csrf-token so that I could use it in subsequent calls. My script looks like below
However, I am getting an empty message box. I tried to check all response header with getAllResponseHeaders() and I couldn't find x-csrf-token listed. However, it does exist in header as I was able to fetch it using POSTMAN.
Please suggest how to get x-csrf-token from Excel using VBA script.
Regards,
I am trying to fetch x-csrf-token so that I could use it in subsequent calls. My script looks like below
VBA Code:
Sub ExternalTrigger_Click()
Dim response As String
Set objHTTP = CreateObject("MSXML2.XMLHTTP")
Url = "XXXXXXXXXX"
username1 = "XXXXX"
password1 = "XXXXX"
objHTTP.Open "GET", Url, False, username1, password1
objHTTP.setRequestHeader "x-csrf-token", "fetch"
objHTTP.send ("")
response = objHTTP.GetResponseHeader("x-csrf-token")
MsgBox response
End Sub
However, I am getting an empty message box. I tried to check all response header with getAllResponseHeaders() and I couldn't find x-csrf-token listed. However, it does exist in header as I was able to fetch it using POSTMAN.
Please suggest how to get x-csrf-token from Excel using VBA script.
Regards,