Tag: linkedin

如何使用gem’inlease’登录用户的完整个人资料信息,:git =>“git://github.com/pengwynn/linkedin.git”?

我正在使用gem ‘linkedin’, :git => “git://github.com/pengwynn/linkedin.git” 当我创建客户端并获取配置文件时,我得到以下值 headline: url: last_name: first_name:summary 我的问题是如何获得用户的 picture-url,public_profile_url: location: country: school_name: degree: field_of_study: start_date: end_date:

如何将rails客户端转换为Hash

我像这样创建linkedin客户端。 client = LinkedIn::Client.new(“3333”, “rrrrrrr”) client.authorize_from_access(session[:atoken], session[:asecret]) 并获得这样的个人资料信息 @profile = client.profile 当我打印像“ puts client.profile ”这样的配置文件时,我得到以下输出 #<LinkedIn::Profile:0x4a77770 @doc=#<Nokogiri::XML::Document:0x253bb64 name="document" children=[#<Nokogiri::XML::Element:0x253b9fc name="pers on" children=[#, #<Nokogiri::XML::Element:0x253b84c name="first-name" children=[#]>, #, #<Nokogiri::XML::Element:0x253b57c name="last-name" children=[#]>, #, #<Nokogiri::XML::Element:0x253b2ac name="headline" children=[#]>, #, #<Nokogiri::XML: :Element:0x253afdc name="site-standard-profile-request" children=[#, #<Nokogiri::XML::Element:0x253ade 4 name="url" children=[#]>, #]>, #]>]>> 如何将其解析为hasmap或字符串? 请求帮助我,因为我是铁杆新手。

新的LinkedIn权限:使用rails LinkedIn gem访问过去的职位和教育

Linkedin最近更新了他们的API,使其在某些情况下可以访问的内容限制较少,但在访问方式方面通常更明确。 特别是,您必须在omniauth构建器中具体请求您想要的数据: 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月)。 感谢帮助!

如何从LinkedIn解析Mash以创建Ruby对象

我使用pengwynn的LinkedIn gem来获取LinkedIn的身份validation。 一切正常,我在回调中得到一个Mash,如下所示: #<LinkedIn::Mash all=[#<LinkedIn::Mash company=# id=2851554 is_current=true start_date=# summary=”” title=”Boss”>] total=1> 我怎样才能将它解析为类似于Rails参数的东西,以便从中创建一个新对象? 谢谢。

LinkedIn photo_urls或picture-urls ::(原创)未被退回

所以我在我的Rails 5应用程序中使用omniauth和devise进行LinkedIn身份validation。 omniauth-linkedin-oauth2 (0.2.5) devise (4.4.1) 在大多数情况下,一切都很好用,用户可以使用LinkedIn进行注册和身份validation。 但是,“auth.info.image”中返回的默认图像是50×50,这个图像太小了。 我已经对此做了很多阅读,建议的方法是将“picture-urls ::( original)”添加到设计字段列表中。 这与我在文档中看到的一致( https://developer.linkedin.com/docs/fields/basic-profile )。 然而,这似乎不起作用,我想知道是否有一个错误或这是否是某种过时的信息。 我的devise.rb omniauth配置看起来像: config.omniauth Rails.application.config.omniauth, app_key, app_secret], scope: ‘r_basicprofile r_emailaddress’, fields: %w(id email-address first-name last-name picture-url picture-urls::(original)) 即使在指定了这些字段之后,图片url中也不会返回任何值。 self.remote_photo_url = auth.extra.raw_info.pictureUrls[‘values’].first 我已经检查了返回的数据,并且无处可寻。 不知道我可能会遗漏什么,但任何建议将不胜感激!

OAuth ::问题(parameter_absent)

我正在使用OAuth 0.3.6和一个Rails应用程序的linkedin gem我有这个问题,其中OAuth抛出一个错误,说OAuth :: Problem(parameter_absent)。 问题是它不会在每次被调用时抛出错误,问题是我无法在本地重现问题来测试它。 文件说: [parameter_absent:未收到必需参数。 在这种情况下,响应应该还包含oauth_parameters_absent参数。 ] 但是每次获取令牌时都会以相同的方式生成请求,因此我无法理解为什么会发生这种情况。 日志 OAuth::Problem (parameter_absent): oauth (0.3.6) lib/oauth/consumer.rb:167:in `request’ oauth (0.3.6) lib/oauth/consumer.rb:183:in `token_request’ oauth (0.3.6) lib/oauth/tokens/request_token.rb:18:in `get_access_token’ linkedin (0.1.7) lib/linked_in/client.rb:35:in `authorize_from_request’ app/controllers/users_controller.rb:413:in `linkedin_save’ 我看到有几个人面临这个问题,但我还没有找到解决这个问题的方法。 希望得到一些帮助。

Rails – OAuth ::问题exception:LinkedIn API中的parameter_absent

我正在使用Oauth gem在APi中开发Linked。 同样的gem对我的Twitter API工作得很好,但在Linkedin API的情况下,我收到请求令牌,当它试图获取访问令牌时,它返回错误 OAuth ::问题exception:parameter_absent 代码如下.. consumerKey = “*************************” consumerSecret = “*************************” callbackUrl = “http://localhost/” apiURL = “https://api.linkedin.com” request_token_path = “/uas/oauth/requestToken” access_token_path = “/uas/oauth/accessToken” authorize_path = “/uas/oauth/authorize” @consumer = OAuth::Consumer.new(consumerKey,consumerSecret, { :site => apiURL, :scheme => :header, :http_method => :post, :request_token_path => request_token_path, :access_token_path => access_token_path, :authorize_path => authorize_path }) unless(params[“oauth_token”].nil?) @request_token = […]

Linkedin Ruby Gem(令牌在回调中被拒绝)

我一直在使用LinkedIn Ruby Gem并遇到问题。 这是我的rails服务器的输出。 Started GET “/session/callback?oauth_token=618b3bc2-d8f6-4c9c-99a2-10573c8b3c3c&oauth_verifier=09858” for 127.0.0.1 at Tue Jun 12 19:14:11 -0700 2012 Processing by SessionController#callback as HTML Parameters: {“oauth_verifier”=>”09858”, “oauth_token”=>”618b3bc2-d8f6-4c9c-99a2-10573c8b3c3c”} Completed 500 Internal Server Error in 163ms OAuth::Problem (token_rejected): app/controllers/session_controller.rb:28:in `callback’ Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.2ms) Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.0ms) Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (12.9ms) 这是我的session_controller.rb中的代码: require ‘linkedin’ class SessionController “http://#{request.host_with_port}/session/callback”) session[:rtoken] = request_token.token […]

链接在身份validation和聚合数据中

我正在使用Ruby on Rails构建一个Web应用程序,我希望我的用户对来自Linked In(以及其他像Github,Twitter等等)的数据进行身份validation和聚合。 我正在使用这些gem: 设计注册 omn​​iauth-linkedin用于身份validation pengwynn / linkedin用于数据聚合 虽然,Linked In有一个不太好的pin东西。 有没有办法避免它,并从我的用户帐户获取我想要的数据,而无需他们去链接,获取一个引脚并提交给我? 提前致谢。 authentications_controller.rb class AuthenticationsController < ApplicationController def index @authentications = current_user.authentications if current_user end def create omniauth = request.env["omniauth.auth"] authentication = Authentication. find_by_provider_and_uid(omniauth['provider'], omniauth['uid']) if authentication flash[:notice] = "Signed in successfully." sign_in_and_redirect(:user, authentication.user) elsif current_user current_user.authentications. create!(provider: omniauth['provider'], uid: omniauth['uid']) current_user.apply_omniauth(omniauth) flash[:notice] […]

如何获取Linkedin用户数据?

我正在使用Linkedin API来获取RoR项目中的用户内容。 我正在关注这个博客。 这是控制器代码: 基本档案(工作正常) client = get_client profile = client.profile(:fields => [“first-name”, “last-name”, “maiden-name”, “formatted-name” ,:headline, :location, :industry, :summary, :specialties, “picture-url”, “public-profile-url”]) 经验和职位: client = get_client positions = client.profile(:fields => [:positions]).positions.all 对于教育: client = get_client educations = client.profile(:fields => [:educations]).educations.all 而get_client 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 […]