auth0 / passport-linkedin-oauth2

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

Failed to fetch user profile #46

Open jeerbl opened 7 years ago

jeerbl commented 7 years ago

Passport: 0.3.2 Passport LinkedIn OAuth2: 1.5.0

Hello,

I am getting this error

{ InternalOAuthError: failed to fetch user profile
    at /var/www/app/node_modules/passport-linkedin-oauth2/lib/oauth2.js:29:28
    at passBackControl (/var/www/app/node_modules/oauth/lib/oauth2.js:132:9)
    at IncomingMessage.<anonymous> (/var/www/app/node_modules/oauth/lib/oauth2.js:157:7)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:973:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickDomainCallback (internal/process/next_tick.js:122:9)
  name: 'InternalOAuthError',
  message: 'failed to fetch user profile',
  oauthError:
   { statusCode: 500,
     data: '{\n  "errorCode": 0,\n  "message": "Internal service error",\n  "requestId": "6W0LU8F5SA",\n  "status": 500,\n  "timestamp": 1493372235513\n}' } }

When some of our users try to log in via LinkedIn. I am requesting only r_emailaddress and r_basicprofile. The user gets to the LinkedIn login page, logs in and then this error is sent back;

It happens only for some users, not all.

Do you have any idea where this might come from?

Thanks, Jerome

IrvBriscoe commented 6 years ago

Were you able to get a resolution on this?

itsheng commented 6 years ago

@IrvBriscoe You might take a look at the end of this thread. It works for me. https://github.com/auth0/passport-linkedin-oauth2/issues/24

andrerpena commented 6 years ago

Yes @itsheng , @IrvBriscoe and @jeerbl . The solution to the problem is at the end of https://github.com/auth0/passport-linkedin-oauth2/issues/24. I was working for 6 months in a project in suddently yesterday, around 7PM GMT. LinkedIn started crashing and I panicked. But it's now solved.

Rikhart commented 5 years ago

I have the same problem I tested @andrerpena all cases buy still fails.

nicolasdao commented 5 years ago

@Rikhart I had the same problem. Some profile fields for some users make the LinkedIn DB fail. Instead of asking for all fields in each scope, you can cherry-pick which field you need, and try to avoid the fields that make the oauth2 fail. That's still a pain as those fields may vary from one user to the other, but by restricting the oauth2 to just what you need, this helps to mitigate the issue. To cherry-pick those fields, use the sample described in this answer:

https://github.com/auth0/passport-linkedin-oauth2/issues/24#issuecomment-358489355

Hope this helps. Good luck with LinkedIn ;)

techyaura commented 4 years ago

One of the reason is that LinkedIn has changed its permission type, now there is no basic profile One have to use r_liteprofile instead of r_basicprofile.

API scope should be r_emailaddress r_liteprofile'