簡體   English   中英

Linkedin Gem 無法查看個人資料

[英]Linkedin Gem Can't View Profile

我已經為此苦苦掙扎了好幾天,希望有人能提供幫助:)

我通過linkedin gem 和oauth_plugin 連接到Linkedin。 一切看起來都很好,但我無法從中獲取任何信息。 Twitter、facebook 等都運行良好。

安裝后,我遇到了“nil:NilClass 的未定義方法‘downcase’”的一些問題,通過將站點參數添加到 oauth 選項來解決。

現在它幾乎就像它甚至沒有連接......

我的模型如下:

require 'linkedin'
class LinkedinToken < ConsumerToken
  def client
    client = LinkedIn::Client.new(LinkedinToken.consumer.key, LinkedinToken.consumer.secret)
    client.authorize_from_access(token, secret)
    @client = client.profile
  end
end

節目:

Linkedin: <% @user.linkedin_token.client %>

我真的沒有 output? 我到底做錯了什么??

- 更新 -

如果我將 model 更改為:

require 'linkedin'
class LinkedinToken < ConsumerToken
  def client
    oauth = LinkedIn::Client.new(LinkedinToken.consumer.key, LinkedinToken.consumer.secret)
    oauth.authorize_from_access(token, secret)
  end
end

並展示給:

<%= @user.linkedin_token.client %>

我最終得到了這個:

["92af0f43-380d-45ef-90bb-a0a509c1baf0", "26c92c3f-1e84-458b-adc6-7b712a215222"]

這也不對...

我對LinkedIn gem 一無所知,但是...在您的controller 中,您使用@client ,在您看來,您使用@user

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM