Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LinkedIn OAuth Exception Scope NOT_AUTHORIZED r_fullprofile

Everything worked well until today when I received an email from LinkedIn indicating some significant API changes. And subsequently I was seeing Exceptions while authenticating users via. LinkedIn.

Following is the exception from logs

OAuth::Problem (Scope NOT_AUTHORIZED : r_fullprofile):
  oauth (0.4.7) lib/oauth/consumer.rb:178:in `request'
  oauth (0.4.7) lib/oauth/consumer.rb:194:in `token_request'
  oauth (0.4.7) lib/oauth/consumer.rb:136:in `get_request_token'

OAuth logic to get request token.

consumer = OAuth::Consumer.new(LINKED_IN_API_KEY, LINKED_IN_SECRET_KEY,
                 {
                   :site               => "https://api.linkedin.com",
                   :scheme             => :header,
                   :http_method        => :post,
                   :request_token_path => "/uas/oauth/requestToken?scope=r_fullprofile",
                   :access_token_path  => "/uas/oauth/accessToken",
                   :authorizeEmapath     => "/uas/oauth/authorize"
                 })

### Exception occurs at this call.
request_token = consumer.get_request_token(:oauth_callback => callback_url)

Email from LinkedIn

enter image description here

My Analysis till now

If I change the scope to r_basicprofile it works fine but then I don't get skills info of the authenticated linkedin user.

What should be the additional changes I need to do to suffice the API change ?

like image 588
swapab Avatar asked May 13 '15 09:05

swapab


People also ask

What is LinkedIn OAuth?

The LinkedIn API uses OAuth 2.0 for member(user) authorization and API authentication. Applications must be authorized and authenticated before they can fetch data from LinkedIn or get access to LinkedIn member data.


1 Answers

Starting from May 12, 2015, Linkedin has limited the open APIs.

Access to r_fullprofile scopes requires that you apply for and are granted access to this information from LinkedIn. The full profile fields are only available to applications that have applied and been approved for the Apply with LinkedIn use case.

SOLUTION:

Apply for partner status with LinkedIn, explaining what your integration is and how it works. If it meets the criteria of "we feel that they’re providing value to members, developers and LinkedIn," then some or all of the restricted endpoints will remain open for that app, and ONLY that app.

Member profile fields

The following selection of profile fields are available to all LinkedIn developers:

  1. Basic Profile Fields
  2. Location Fields
  3. Position Fields

Member profile fields available to Apply with LinkedIn developers:

The following selection of profile fields are only available to applications that have applied and been approved for the Apply with LinkedIn use case:

  1. Full Profile Fields
  2. Contact Info Fields
  3. Company Fields
  4. Publication Fields
  5. Patent Fields
  6. Language Fields
  7. Skill Fields
  8. Certification Fields
  9. Course Fields
  10. Education Fields
  11. Volunteer Fields

Check out this linkedin page for more details on which fields are available to all the developers and which are not.

like image 124
Rahul Gupta Avatar answered Sep 22 '22 16:09

Rahul Gupta