How to fetch Linkedin user data?

吃可爱长大的小学妹 提交于 2019-11-28 10:15:03

问题


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?


回答1:


I think you need to ask Linkedin a special authorization to access this data. r_fullprofile is only for registered APIs.

  • Data that doesn't need any special authorization: r_basicprofile
  • Data that needs to apply for LinkedIn partnership program: r_fullprofile (See here)

Have a look at this documentation in Linkedin's website

To apply to Linkedin's program, visit this page

I applied this morning and they said they would come back to me within 15 days.

Good luck!



来源:https://stackoverflow.com/questions/33849520/how-to-fetch-linkedin-user-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!