0
votes

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!

1

1 Answers

0
votes

This is because the current MVC implementation uses oauth1 and the OAuth1 accessToken will not work for oath2 requests. It is very complicated and I struggle with it myself. You will have to write your own provider. See https://coderwall.com/p/rznlfg. But I need an OAuth2Client integrated implementation for MVC4. Can anybody help, please?