I am having a hard time with LinkedIn API and I am sure I am doing something wrong but I can't figure out what. I have an ASP.NET MVC 4 app and inside AuthConfig.cs I have:
OAuthWebSecurity.RegisterLinkedInClient("apikey", "secretkey");
Using the default AccountController I am able to authenticate against LinkedIn API. Inside ExternalLoginCallback method, I am storing the accessToken in session variable. However, after that I can't use this accessToken to get information about the user's profile. I am always getting a 401 (invalid access token). This is what I have in one of my test methods:
(HttpWebRequest)WebRequest.Create(string.Format("https://api.linkedin.com/v1/people/~?oauth2_access_token={0}", accessToken)
Could anyone point out what I am missing?
Thanks!