Here's what a pretty solid example looks like.
http://mrsarker.wordpress.com/2011/08/20/linkedin-rest-api-in-asp-net-mvc/
[HandleError] public class LinkedInController : Controller { public ActionResult index() { return AuthenticateToLinkedIn(); } static string token_secret = ""; public ActionResult AuthenticateToLinkedIn() { var credentials = new OAuthCredentials { CallbackUrl = "http://localhost/home/callback", ConsumerKey = ConfigurationManager.AppSettings["ConsumerKey"], ConsumerSecret = ConfigurationManager.AppSettings["ConsumerSecret"], Verifier = "123456", Type = OAuthType.RequestToken }; var client = new RestClient { Authority = "https://api.linkedin.com/uas/oauth", Credentials = credentials }; var request = new RestRequest { Path = "requestToken" }; RestResponse response = client.Request(request); token = response.Content.Split('&').Where(s => s.StartsWith("oauth_token=")).Single().Split('=')[1]; token_secret = response.Content.Split('&').Where(s => s.StartsWith("oauth_token_secret=")).Single().Split('=')[1]; Response.Redirect("https://api.linkedin.com/uas/oauth/authorize?oauth_token=" + token); return null; } string token = ""; string verifier = ""; public ActionResult Callback() { token = Request["oauth_token"]; verifier = Request["oauth_verifier"]; var credentials = new OAuthCredentials { ConsumerKey = ConfigurationManager.AppSettings["ConsumerKey"], ConsumerSecret = ConfigurationManager.AppSettings["ConsumerSecret"], Token = token, TokenSecret = token_secret, Verifier = verifier, Type = OAuthType.AccessToken, ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader, SignatureMethod = OAuthSignatureMethod.HmacSha1, Version = "1.0" }; var client = new RestClient { Authority = "https://api.linkedin.com/uas/oauth", Credentials = credentials, Method = WebMethod.Post }; var request = new RestRequest { Path = "accessToken" }; RestResponse response = client.Request(request); string content = response.Content; string accessToken = response.Content.Split('&').Where(s => s.StartsWith("oauth_token=")).Single().Split('=')[1]; string accessTokenSecret = response.Content.Split('&').Where(s => s.StartsWith("oauth_token_secret=")).Single().Split('=')[1]; var company = new LinkedInService(accessToken, accessTokenSecret).GetCompany(162479);
source share