get linkedin friends list in ruby on rails

Hi i have found solution to how to get linked in friends list using token and secret.
First of fall you should must authenticated with linkedin.
Put this code where you want to fetch linked in friends.

 client = linked_in_client(current_user.authentication)

@profile = client.profile
 @my_connections = client.connections.all


def linked_in_client(detail)
    LinkedIn.configure do |config|
      config.token = "75keyc3e2w7pyc"
      config.secret = "97c1znGyaEJrM8bY"
      config.default_profile_fields = ['id', "first-name", "last-name"]
    end
    linked_in = LinkedIn::Client.new
    linked_in.authorize_from_access(detail.token, detail.secret)
    linked_in_client ||= linked_in
  end

Comments

Popular Posts

How to pass hash in Postman

nginx: unrecognized service

Reading Excel Sheets using "Roo" gem in ruby on rails

Bootstrap Select Picker append add new item if search not exist

Add CORS to Nginx on AWS Elastic Beanstalk

Enable gzip compression on Elastic Beanstalk with nginx

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

Get video duration by URL in Ruby on Rails

site-enables nginx setting in ruby in rails