Reputation: 4950
I am currently developing a Rails web application that requires a user to login through LinkedIn. After that I want to embed the Member Profile
plugin in his/her profile page.
For that to happen I need to have the public URL, without it the plugin will not work. I already have full profile permission r_fullprofile
on LinkedIn login. But still I am not able to find the API to extract public url.
Is there a way to get that URL?
Upvotes: 3
Views: 3312
Reputation: 16659
You can specify public-profile-url
as a default field:
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
and then using the pengwynn LinkedIn gem you can access the URL like so:
client = LinkedIn::Client.new
client.authorize_from_access("access_token", "access_token_secret")
client.profile(:fields => ["public-profile-url"])
Upvotes: 4