Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.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 3.2 使用omniauth linkedin进行教育、技能和联系_Ruby On Rails 3.2_Omniauth_Linkedin - Fatal编程技术网

Ruby on rails 3.2 使用omniauth linkedin进行教育、技能和联系

Ruby on rails 3.2 使用omniauth linkedin进行教育、技能和联系,ruby-on-rails-3.2,omniauth,linkedin,Ruby On Rails 3.2,Omniauth,Linkedin,我正在Rails中使用omniauth linkedin gem,并试图从“r_fullprofile”和“r_network”获取数据 在omniauth.rb中: provider :linkedin, 'consumer_key', 'consumer_secret', :scope => 'r_fullprofile r_emailaddress r_network', :fields => ["id", "email-address",

我正在Rails中使用omniauth linkedin gem,并试图从“r_fullprofile”和“r_network”获取数据

在omniauth.rb中:

  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", "skills", "date-of-birth", "phone-numbers",        
                   "educations", "three-current-positions" ]
在控制器中:

render :text => request.env["omniauth.auth"].to_yaml

结果输出似乎只有“r_basicprofile”的数据。我如何获得用于解析其余所需数据(例如“连接”、“技能”、“教育”)的数据?

我在使用Deave的Omniauth时遇到了相同的问题

我必须做一个更改,将:fields=>[…]放在花括号中

就你而言:

  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", "skills", "date-of-birth", "phone-numbers",        
                   "educations", "three-current-positions" ]}

希望这有帮助。

不知道这是否对您有帮助,但现在有些字段有了不同的名称。我把这个放在designe.rb上,它就工作了:

config.omniauth :linkedin, ENV['OAUTH_LINKEDIN_ID'], ENV['OAUTH_LINKEDIN_SECRET'],
fields: %w(id email-address first-name last-name headline industry picture-url public-profile-url location num-connections), image_size: {height: 1600}

connections
现在是
num connections
,请参见

,这应该不会有任何区别-这对您真的有效吗?您能看一下吗