简体   繁体   中英

Linkedin Gem Can't View Profile

I've been struggling with this now for days, hope someone can help:)

Am connected to Linkedin with the linkedin gem and the oauth_plugin. Everything looks just fine but I cannot get any information out of it. Twitter, facebook etc. are all working great.

After installing, I ran into some issues with "undefined method `downcase' for nil:NilClass" which was resolved by adding site parameter to oauth options.

Now it's almost like it's not even connecting...

My model's as follows:

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

show:

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

I literally get no output? What on earth am I doing wrong??

-- UPDATE --

If I change the model to:

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

And show to:

<%= @user.linkedin_token.client %>

I end up with this:

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

Which isn't right either...

I don't know anything about the LinkedIn gem but... in your controller you use @client and in your view you use @user

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM