Finally found a way to do this successfully ..! I am duplicating the code used to implement Facebook authentication in Owin / Katana. You can find it here.
The source code of the Katana project
I copied all the files and the folder indicated in the red box in the following figure.

Paste them into my own MVC 5 web application project where I need to implement LinkedIn authentication. Renamed all classes as LinkedIn instead of Facebook.

And then I changed the code to adapt it to LinkedIn.
- Constant Class Changed DefaultAuthenticationType for LinkedIn instead of Facebook.
LinkedInAuthenticationHandler Class
private const string TokenEndpoint = "https://www.linkedin.com/uas/oauth2/accessToken"; private const string GraphApiEndpoint = "https://api.linkedin.com/v1/people/~";
Modify this code inside the ApplyResponseChallengeAsync method.
string authorizationEndpoint = "https://www.linkedin.com/uas/oauth2/authorization" + "?response_type=code" + "&client_id=" + Uri.EscapeDataString(Options.AppId) + "&redirect_uri=" + Uri.EscapeDataString(redirectUri) + "&scope=" + Uri.EscapeDataString(scope) + "&state=" + Uri.EscapeDataString(state);
LinkedInAuthenticationOptions Class
CallbackPath = new PathString("/signin-linkedin");
Then go to the Startup.Auth.cs file in the App_Start folder in your project and add this code to it.
app.UseLinkedInAuthentication( APIKey: "...YourLinkedInAPIKeyHere...", SecretKey: "...YourLinkedInSecretKeyHere..." );
Provide information about your application in the LinkedIn API. You can read more about this here.
Using LinkedIn Authentication
It's all. Good luck
Jake
source share