Keeping ‘LinkedIn’: experiences developing a plugin to maintain up-to-date user data

This blog was originally written by Doug Lerner, of Elliptics.com

Introduction

IDS has developed a functioning API connection to LinkedIn. It aims to provide a tool for augmenting the quantity of and improving the recency of user profile data on the Eldis Communities platform.

This is a technical document describing profile data available from LinkedIn, the user experience with which members of Eldis Community members can connect their profiles to LinkedIn, how the communications work between Eldis Communities and LinkedIn, and how retrieved data is used at Eldis Communities.

Profile data available from LinkedIn

LinkedIn makes various APIs available which allow developers a chance to offer their members an option to allow access to parts of their profile information (fields) for certain restricted uses.

Following LinkedIn policy  changes over the last few years, the various fields available through these APIs are the following (ref: https://developer.linkedin.com/docs/fields):

Available to all LinkedIn developers:

Basic Profile Fields, Location Fields, Position Fields

Other fields available only to applications which have been approved by the Apply with LinkedIn program:

Full Profile Fields, Contact Info Fields, Company Fields, Publication Fields, Patent Fields, Language Fields, Skill Fields, Certification Fields, Course Fields, Education Fields, Volunteer Fields, Recommendation Fields

At Eldis Communities, all retrieved fields are stored in the object-oriented database and are available for reporting, sending to the IDS SOLR index and for other internal uses.

In addition, some of the fields are shown on the member’s profile page, replacing custom Eldis Communities profile fields which have a similar purpose (e.g. the “summary” field retrieved from LinkedIn replaces the displayed “About Me” personal description in the member’s profile).

Eldis Communities makes use of the following fields from within the Basic Profile Fields, Location Fields and Position Fields options.

LinkedIn Field How used at Eldis Communities
First-name Stored only
Last-name Stored only
Headline Shown in profile, replacing Job Title
Location Country code is stored only; a descriptive location and country name are shown in profile, replacing Country of Residence
Industry Stored only
Num-connections Stored only
Summary Shown in profile, replacing About Me
Positions Shown in profile, replacing Position Type
Public-profile-url Shown in profile, points back to the member’s LinkedIn profile

Prior to changes in API availability, which occurred in the middle of our initial development, the following fields were also retrieved: interests, publications, languages, skills, educations, and num-recommenders.

User experience – how users are presented with the opportunity to connect with LinkedIn

All Eldis Community site members, except those who are joined only to excluded groups, are shown various light boxes which offer LinkedIn access and step them through the process, including granting permission to access their profile information.

Example of a light box offering LinkedIn access to a site member.

When presented with the light box, the user can choose to “go to LinkedIn” to grant permission, decline to participate or request to be reminded.

If the user proceeds, they are taken to the LinkedIn site, where they can allow access or or cancel.

At LinkedIn, the member can Allow Access

If the member allows access, they are then returned to Eldis Communities and see another light box giving a confirmation.

Back at Eldis Communities, the confirmation light box

From that point on, the member’s profile page is updated to include the fields retrieved from LinkedIn, plus some custom fields from Eldis Communities which are unique to the site: Interests, Languages Spoken, Regions of Expertise and Countries of Interest.

Also, from then on, unless the member reverts to using only Eldis Communities custom profile information, the member only has access to and can modify the unique fields listed above, as well as the Eldis Communities required fields.

How Eldis Communities connects to LinkedIn

In addition to the user experience described above, quite a lot goes on behind the scenes to coordinate the information flow between Eldis Communities and LinkedIn.

The steps involved are described in the LinkedIn developer documentation (ref: https://developer.linkedin.com/docs/oauth2 ) and include the following:

  1. Configuring the LinkedIn application, which involves establishing OAuth 2.0 authentication, HTTPS connections for the transfer of data and special callback URLs for redirection. In this step, authentication keys are exchanged and the client’s “secret” code is verified to prevent spoofing.
  2. An authentication code is requested, which is part of the light box interaction described in the previous section, where the member is redirected to LinkedIn and then redirected back to Eldis Communities.
  3. The received authentication code is exchanged, via special API calls, for an access token, which is ultimately used to make requests to LinkedIn. The token is valid for 60 days and is stored securely as part of the member’s record at Eldis Community.
  4. Authenticated requests are made, as per the API, tokens are confirmed, and if all is well the requested data is returned.

The data is returned as a JSON object and stored in the member’s record in the object-oriented database. When needed, for profiles or reports or other APIs, such as data produced for the IDS SOLR index, this stored JSON object is parsed and the needed information is formatted and used on the profile page, or sent via XML for reports, or displayed at the site via special LinkedIn logs available to site admins.

To enable the communications described above, and to keep the API secure and as standard as possible, a third API server was created in the same London data center where Eldis Communities resides. This API server uses Apache and PHP and acts as an intermediary between the Eldis Communities server and the LinkedIn server,

Therefore, the Eldis Communities site does not directly connect to the LinkedIn API server, except to redirect the member to LinkedIn initially. All other communications are with the intermediate Special API server, running a standard LAMP (Linux, Apache, MySQL, PHP) configuration, though for this use MySQL is not required.

Try it yourselves

The PHP scripts are included in the appendix (with confidential keys hidden) and can be placed in GIT repositories if desired, and provided to others as a reference point for similar development.

On the Eldis Communities side the scripting language is server-side JavaScript and the database used is the Webcrossing NoSQL object-oriented database.

Note – the appendix to this page, containing the php code required to communicate between the Eldis Communities site and the LinkedIn API server is available to download.

Leave a Reply

Your email address will not be published. Required fields are marked *