Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/52.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 如何获取Linkedin用户数据?_Ruby On Rails_Ruby_Linkedin_Linkedin Api_Gemset - Fatal编程技术网

Ruby on rails 如何获取Linkedin用户数据?

Ruby on rails 如何获取Linkedin用户数据?,ruby-on-rails,ruby,linkedin,linkedin-api,gemset,Ruby On Rails,Ruby,Linkedin,Linkedin Api,Gemset,我正在使用linkedinapi获取RoR项目中的用户内容。我在关注博客。以下是控制器代码: 基本配置文件(工作正常) 经验和职位: client = get_client positions = client.profile(:fields => [:positions]).positions.all 教育方面: client = get_client educations = client.profile(:fields => [:educations]).educations

我正在使用
linkedinapi
获取
RoR
项目中的用户内容。我在关注博客。以下是控制器代码:

基本配置文件(工作正常)

经验和职位:

client = get_client
positions = client.profile(:fields => [:positions]).positions.all
教育方面:

client = get_client
educations = client.profile(:fields => [:educations]).educations.all
get\u客户端

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()
看看

要申请Linkedin的计划

我今天早上申请了,他们说他们会在15天内回来找我


祝你好运

您确定您的api密钥能够查看完整的配置文件信息吗?它们可能会限制您可以从用户处获取的数据量。这只是一个猜测,因为我不熟悉他们的API。啊!你说得对。现在我在
r\u fullprofile
中没有发现范围未定义错误,但如果我将其更改为
r\u basicprofile
至少我可以获得基本配置文件。我在某个地方看到我们需要填这张表。对吗?要获得职位和技能,我需要
r\u fullprofile
accessibility吗?对于
r\u fullprofile
范围,我需要填写“合作伙伴计划”表吗?@AmitPal我建议结束这个问题,因为它似乎已经解决了。我还建议在论坛上询问有关申请API的问题,但不要在这个网站上。LinkedIn开发者或其他媒体会有更好的帮助。@HunterStevens我仍然很困惑。我在评论中所说的是否正确?有些用户不阅读评论,除非他们有相同的问题。大多数用户会认为你的问题没有答案,而只是忽略它(因为他们自己不知道答案)。我想说的是,在聊天室、论坛或其他地方询问申请流程可能会得到最好的反馈。似乎我可以访问
r\u basicprofile
范围中的
位置。“所有LinkedIn开发人员都可以选择以下配置文件字段:基本配置文件字段、位置字段、职位字段。我得到的是
[]
Mash 0
。为什么会这样?如果你想访问职位,你需要:1/在omniauth配置中添加“职位”,2/检索它们(例如)oauth.extra.raw_info.positions。您将获得用户位置的哈希值。
:request_token_path => '/uas/oauth/requestToken?scope=r_fullprofile'