I am currently working on an automation project with RPA and I am stuck in the use of the http Request activity. I need to send an http Request to the authentication service and obtain the authentication token contained in the response cookies. I tried several methods found on the forum but I can’t get my cookies.
I have referred to Get cookies from httpRequest response already but found the thread as incomplete, hence raising another thread here. My problem is quite similar, in the response Header, I do not find the values of the cookies. So, is there any other way to retrieve all the cookies values? Please help. Thanks in advance
Dim client As RestSharp.RestClient = New RestSharp.RestClient(endPoint)
client.CookieContainer=New System.Net.CookieContainer
Dim request As RestSharp.RestRequest = New RestRequest()
request.AddHeader("Referer", strReferer)
request.AddHeader("Content-Type", "application/x-www-form-urlencoded")
request.AddParameter("type", strType)
request.AddParameter("encpwd", strEncPwd)
request.AddParameter("user", strUser)
request.AddParameter("pwd", strPwd)
request.AddParameter("admsid", stradmsID)
Dim response As IRestResponse= client.Execute(request)
Dim cookies As String =
client.CookieContainer.GetCookieHeader(response.ResponseUri)
Console.WriteLine("cookieJar " + cookies.ToString)
The above code works for me now inside invoke code activity