简体   繁体   中英

Authorizing a HttpClient Request

I'm trying to access twitter user's followers page, but the content isn't available to guests.

using (var res = await http.GetAsync("http://www.twitter.com/" + handle + "/followers"))
{
    followers = new List<string>();
    ...
    // res returns a login page

Is there any simple way to authorize my request in ASP.NET? Can I somehow use cookies of a client that is sending a request to my ASP.NET page?

Okay, that's a stupid idea. Is there anything else that would work?

I do it like this:

var authenticationCookie = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];

and then use the authenticationCookie to call the API on user's behalf.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM