Nowadays it's quite common to 'sign in' to websites using Facebook, Twitter or LinkedIn credentials. Especially for a professional audience the LinkedIn API (Application Programming Interface) comes in handy to facilitate an easy sign in. With this API it's not only possible to share content of a particular site but also to authenticate users in order to sign in to your site (for more info about the OAuth 2.0 Authorization Framework see The OAuth 2.0 Authorization Framework). At the same time, while a user logs in to your site, it's possible to collect valuable data about this user (after permission from the user to access his or her data). Likewise, besides a 'sign in', it's also possible to create a user account filled with data from LinkedIn. The following steps show how this process works:

1. First of all register your application at https://www.linkedin.com/secure/developer

2. After registration you will have access to an API key, the Client ID (to identify your app) and a Secret key (keep it secure).

3. You will also need the inital LinkedIn OAuth URL, the scope (specifying the info you need), and a redirect URL on which LinkedIn will reply.

4. After the request is send (in this example by means of the button 'Create account using LinkedIn'), and the user thus granted permission, collect the returned parameters (on succes a temporary authorization code as GET parameter) and pass them to the LinkedIn Api class.

5. It's only in this class that the LinkedIn OAuth URL is called to get an access token in order to authorize API requests.

6. With this access token an authenticated API requests (with the desired Api request format, either JSON or XML) on behalf of the user is made to https://api.linkedin.com/v1/people/ to collect the desired data. The subsequent response containing the data could be saved to a database and/or printed on screen directly.

7. Have fun with the API and if you need assistance implementing the LinkedIn API feel free to contact Blue Cliff Concepts.


Take a look at the result:

Create account using LinkedIn

comments powered by Disqus