Linkedin Gem cannot view profile

I struggled with this now all day, I hope someone can help :)

I am connected to Linkedin with related pearls and oauth_plugin. Everything looks just fine, but I can’t get any information from him. Twitter, facebook, etc. Everything works great.

After installation, I ran into some problems with the "undefined" downcase "method for nil: NilClass", which was resolved by adding a site parameter to the oauth options.

Now, it’s almost not connecting ...

My model is 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 don't get a way out! What 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:

<%= @user.linkedin_token.client %>

As a result, I get the following:

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

Which is also wrong ...

+3
source share
1

LinkedIn, ... @client, @user

+1

All Articles