Question

I'm trying to access some basic profiles datas with the SpringSocialLinkedin 1.0.0.RC3. Here is how I proceed :

String industry = connection.getIndustry();
String headLine = connection.getHeadline();
String summary = connection.getSummary();

Let's know picture a random connection having all these fields fill. What I'll get is his industry and his headline . However, in place of his summary, I'll get a null value. As a consequence, I was wondering : is this a known bug due to the version of the module or is there something wrong elsewhere ?

EDIT : Thanks to a nice fellow, I managed to make the 1.0.0.3 run nicely. However, I still can't manage to get connections summaries.

EDIT BIS : I can only get my own summary. My contact's summaries are hidden from my app.

Était-ce utile?

La solution

In fact, the trouble comes from LinkedIn. However, there is a way to dodge the problem using the linkedin.restOperations()supplied by Spring social. Here is how I proceeded :

String url = String.format("https://api.linkedin.com/v1/people/id=%s:(summary)", connection.getId());
LinkedInProfile summaryProfile = source.restOperations().getForObject(url, LinkedInProfile.class);
String summary = summaryProfile.getSummary();

This way, the summary is well recovered, at the cost of an extra REST query. Another downside of this method is the fact that search operations are limited to 100 queries a day per user.

Autres conseils

EDIT. It is true, summary is included in the basic profile. So normally you must be able get it. It looks like a bug on LikedIn side.

I am almost sure that you need to request `r_fullprofile` permission to be able get summary (see [corresponding documentation entry][2]). To do it with Spring Social you can try to: add corresponding parameter to signin form
<form name="linkedinin_signin" id="linkedin_signin" action="${linkedin_uri}" method="POST">
    <input type="hidden" name="scope" value="r_fullprofile" />
</form>
and use some [more recent Spring Social version][3]. Support for Linked In scopes was added starting from Spring Security version 1.1.0.M2. Hope it helps.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top