I am using RestSharp 102.4. The API I'm trying to access is
NewsBlur
The app flow is like this:
- Login to the app.
request.AddParameter("username", _username);
request.AddParameter("password", _password);
request.Resource = "api/login";
return Execute<LoginResponse>(request);
- Fetch the feeds
var request = new RestRequest(Method.GET);
request.Resource = "reader/feeds";
request.AddParameter("include_favicons", include_favicons);
request.AddParameter("flat", flat);
request.AddParameter("update_counts", update_counts);
return Execute<Feed>(request);
_cookie_name & _cookie_value are set during the Login phase. Now, during this phase, the cookies obtained from the login are not obtained and as a result trying to get the feeds results in 403. I tried setting Cookies obtained in the login phase using:
request.AddHeader("Cookie: ",_cookie_name +"=" + _cookie_value);
but an error message was raised,
ErrorMessage "Specified value has invalid HTTP Header characters.\r\nParameter name: name"
Could anyone let me know as to where I am going wrong? How can I set the cookies or make RestSharp use the existing ones?