加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – 如何获取Linkedin用户数据?

发布时间:2020-12-16 19:31:22 所属栏目:百科 来源:网络整理
导读:我正在使用Linkedin API来获取RoR项目中的用户内容.我关注 this博客.这是控制器代码: 基本档案(工作正常) client = get_clientprofile = client.profile(:fields = ["first-name","last-name","maiden-name","formatted-name",:headline,:location,:industr
我正在使用Linkedin API来获取RoR项目中的用户内容.我关注 this博客.这是控制器代码:

基本档案(工作正常)

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"])

经验和职位:

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

对于教育:

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

而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

对于范围我设置:

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

我能够获得基本个人资料信息,但不能获得其他信息.对于其他领域,我变空了[].我在这做错了什么?

解决方法

我想你需要向Linkedin提出特殊授权才能访问这些数据. r_fullprofile仅适用于已注册的API.

>不需要任何特殊授权的数据:r_basicprofile
>需要申请LinkedIn合作伙伴计划的数据:r_fullprofile(See here)

看看this documentation in Linkedin’s website

申请到Linkedin的计划,visit this page

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

祝你好运!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读