问题
Linkedin recently updated their API, making it less restrictive in terms of what you can access in some cases but generally more explicit in terms of how you must access it.
In particular, you must request specifically what data you want in the omniauth builder:
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
See: https://github.com/skorks/omniauth-linkedin
Unlike the fields in quotations that precede it (all of which are part of generally accessible profile information), "connections" is a structured object that must be requested explicitly here (the preceding ones are accessible by default).
I'm more interested in "positions" and "educations" fields, which like "connections" are structured objects. For example, positions contains data on company, title, start date, end date per position:
http://developer.linkedin.com/documents/profile-fields
How do I make the right request in my omniauth builder for fields within positions and educations? I had access to them with my old API key but not the newly released one (as of August). Help is appreciated!
回答1:
Looks like you're granting r_fullprofile permissions to your application. That's the correct member permission. However, that will only grant you full profile fields to the authenticated user (of which the Position and Education fields are composed of). With your 1st and 2nd degree connections, you can only retrieve fields that Basic Profile fields (as part of the r_basicprofile member permission)
回答2:
you need to add educations field along with scope so your fields will become something like
:fields => ["id", "email-address", "first-name", "last-name", "headline",
"industry", "picture-url", "public-profile-url", "location", "connections", "educations"]
for detail please see https://developer.linkedin.com/documents/profile-fields#educations
来源:https://stackoverflow.com/questions/12116853/new-linkedin-permissions-accessing-past-positions-and-educations-using-rails-li