Ruby on rails 3.2 使用omniauth linkedin进行教育、技能和联系
我正在Rails中使用omniauth linkedin gem,并试图从“r_fullprofile”和“r_network”获取数据 在omniauth.rb中: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",
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
,请参见,这应该不会有任何区别-这对您真的有效吗?您能看一下吗