Omniauth linkedin gem不再在rails app上提供完整的个人资料

时间:2014-10-27 04:23:22

标签: ruby-on-rails linkedin omniauth

我目前正试图获取用户的完整个人资料,以便访问她过去的三个职位。 API工作正是我想要的,我在旧的提交中找不到确切的错误。这是我对linkedin-omniauth的初始化程序。

这是我的初始化程序:

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

我一直在和田地玩几个小时,但不知道该放什么。以下是我一直使用的2种资源:

我正在使用gems omniauth和omniauth-linkedin,Ruby on Rails 4.1.4和ruby 2.1.2。

1 个答案:

答案 0 :(得分:2)

只需将positions添加到字段数组:

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