【问题标题】:New LinkedIn permissions: accessing past positions and educations using rails LinkedIn gem新的 LinkedIn 权限:使用 rails LinkedIn gem 访问过去的职位和教育
【发布时间】:2012-08-24 21:24:26
【问题描述】:

Linkedin 最近更新了他们的 API,使其在某些情况下可以访问的内容限制更少,但在访问方式方面通常更加明确。

特别是,您必须在omniauth builder中明确请求您想要的数据:

Rails.application.config.middleware.use OmniAuth::Builder do   
   provider :linkedin, "consumer_key", "consumer_secret", 
      :scope => 'r_fullprofile r_emailaddress r_network', 
      :fields => ["id", "email-address", "first-name", "last-name", "headline", 
            "industry", "picture-url", "public-profile-url", "location", "connections"]   
end

见:https://github.com/skorks/omniauth-linkedin

与前面引号中的字段(所有这些字段都是一般可访问的配置文件信息的一部分)不同,“连接”是必须在此处明确请求的结构化对象(默认情况下可访问前面的字段)。

我对“职位”和“教育”字段更感兴趣,它们和“人脉”一样是结构化对象。例如,职位包含有关每个职位的公司、职位、开始日期、结束日期的数据:

http://developer.linkedin.com/documents/profile-fields

如何在我的 omniauth 构建器中针对职位和教育中的字段提出正确的请求?我可以使用旧 API 密钥访问它们,但不能使用新发布的密钥(截至 8 月)。感谢您的帮助!

【问题讨论】:

  • 你有没有想过如何做到这一点?

标签: ruby-on-rails omniauth linkedin


【解决方案1】:

您似乎正在向您的应用授予 r_fullprofile 权限。这才是正确的会员权限。但是,这只会将完整的个人资料字段授予经过身份验证的用户(由职位和教育字段组成)。通过您的 1 级和 2 级连接,您只能检索 Basic Profile 字段的字段(作为 r_basicprofile 成员权限的一部分)

【讨论】:

    【解决方案2】:

    您需要添加教育领域以及范围,这样您的领域就会变成类似

    :fields => ["id", "email-address", "first-name", "last-name", "headline", 
            "industry", "picture-url", "public-profile-url", "location", "connections", "educations"]
    

    详情请见https://developer.linkedin.com/documents/profile-fields#educations

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-19
      • 2015-08-29
      • 2019-02-27
      • 2019-12-14
      • 1970-01-01
      • 2013-03-02
      相关资源
      最近更新 更多