2

I am using Linkedin API to fetch user content in RoR project. I am following this blog. Here is controller code:

Basic profile (which works fine)

client = get_client
profile = client.profile(:fields => ["first-name", "last-name", "maiden-name", "formatted-name" ,:headline, :location, :industry, :summary, :specialties, "picture-url", "public-profile-url"])

Experience and Positions:

client = get_client
positions = client.profile(:fields => [:positions]).positions.all

For Educations:

client = get_client
educations = client.profile(:fields => [:educations]).educations.all

Whereas get_client

def get_client
linkedin_oauth_setting = LinkedinOauthSetting.find_by_user_id(current_user.id)
client = LinkedIn::Client.new('aaadad', 'dadada', @@config)
client.authorize_from_access(linkedin_oauth_setting.atoken, linkedin_oauth_setting.asecret)
client
end

For scope I set :

:request_token_path => '/uas/oauth/requestToken?scope=r_fullprofile'

I am able to get Basic profile information but not others. For other fields I am getting empty []. What am I doing wrong here?

4

1 回答 1

2

我认为您需要向 Linkedin 申请特殊授权才能访问这些数据。r_fullprofile仅适用于已注册的 API。

  • 不需要任何特殊授权的数据:r_basicprofile
  • 申请LinkedIn合作计划需要的资料:r_fullprofile(见这里

在 Linkedin 的网站上查看此文档

要申请加入领英计划,请访问此页面

我今天早上申请,他们说他们会在 15 天内回复我。

祝你好运!

于 2015-11-24T10:34:58.517 回答