auth0 / passport-linkedin-oauth2

Passport Strategy for LinkedIn OAuth 2.0
MIT License
119 stars 106 forks source link

Change to version 2 of API consequences #68

Open MathRobin opened 5 years ago

MathRobin commented 5 years ago

First of all, thanks for all the first info in this thread: https://github.com/auth0/passport-linkedin-oauth2/issues/60. Just a question about profile fields asked for signin.

I had an implementation of this strategy which required a lot of fields:

profileFields: [
      'id',
      'first-name',
      'last-name',
      'email-address',
      'headline',
      'summary',
      'industry',
      'picture-url',
      'positions',
      'public-profile-url',
      'location'
    ]

If I understand well the doc, i have to change some of them to this :

profileFields: [
      'id',
      'firstName',
      'lastName',
      'profilePicture'
    ]

But what about the other fields ? what about email, headline, summary, etc. ? Any idea ? How to get them ?

pietersv commented 5 years ago

Per this page, email requires a separate call https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/migration-faq?context=linkedin/consumer/context

How do I retrieve the member's email address? There are no changes to the r_emailaddress permission scope used to retrieve the authenticated member's email address. However, the method used to retrieve the email address has been updated.

Whereas the v1 Profile API returned the email address within the Profile response body, a separate request is to retrieve the email address is now required. Use the request below to retrieve the currently authenticated member's email address:

HTTP

Copy GET https://api.linkedin.com/v2/emailAddress?q=members&projection=(elements*(handle~))

This route requires an auto token, which I think you can get in the callback , but i'm hoping that this repo incorporates that automatically in time for May.

function (token, tokenSecret, profile, done) {
...
}