微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

我正在使用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天内回复我.

祝你好运!

原文地址:https://www.jb51.cc/ruby/271242.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐