Continuing with integrating LinkedIn with my ASP.NET C# app, I came across a few difficulties.
1. Some browsers block popups differently than others.
Doing development in IE (because it’s better integrated with VS 2012) and doing so on an IIS server on “localhost” doesn’t always give you the same results as when you push to Staging or Production. Case in point, having a popup window for users to log into their LinkedIn account worked well on IE, but failed once it was on staging and with Chrome and FireFox. The solution was to take the popup window outside of the AJAX call and make it a direct “window.open” call from “onclick”.
2. Here’s how I handle whether the user clicked cancel at the LinkedIn authorization page or they actually logged in.
3. When users are logged into their LinkedIn account and you send a user to the linked in auth page, it may automatically detect the user is logged in and send you back immediately to the callback URL you provided. It’s important to handle this case in your logic.
4. oAuth 2 is a million times better than oAuth 1a and storing the user’s access token in your DB makes the process of interacting with LinkedIn much more seamless for your users. If you’re struggling with how to handle JSON returned from LinkedIn, copy the json and paste it into this tool which will auto generate C# classes for your JSON. Then you can use JSON.net to convert LinkedIn JSON to your custom classes.