auth0 / lock

Auth0's signin solution
https://auth0.com/docs/libraries/lock
Other
1.13k stars 556 forks source link

[LinkedIn] InternalOAuthError: failed to fetch user profile (status: 500) #1602

Closed dandrei closed 5 years ago

dandrei commented 5 years ago

Hey everyone,

I have the following use case & issue.

What works

I have setup LinkedIn authentication for a web app and it's running smooth for most users. The flow is the following:

  1. They click the "Log in with LinkedIn" button in Lock.
  2. They are taken to the LinkedIn site to login to LinkedIn (https://www.linkedin.com/uas/login?session_redirect=%2Foauth%2Fv2%2Flogin-success%3Fapp_id ...).
  3. They are redirected to back to the site, under /callback#access_token ... (the info is coded in the URL hash and it gets parsed by WebAuth from auth0-js (webAuth.parseHash((err, authResult) => { ...)).

All fine and good so far.

What fails

The problem is that for one particular user, the authentication started failing a few days ago, even though it worked before!

It fails at point 3, LinkedIn doesn't return the regular hash (#access_token ...), but returns an error: (/callback#error=invalid_request&error_description=InternalOAuthError%3A%20failed%20to%20fetch%20user%20profile%20(status%3A%20500%20data%3A%20%7B%0A%20%20%22errorCode ...).

 InternalOAuthError: failed to fetch user profile (status: 500)

What I tried to solve it:

What I haven't yet tried is deleting the user from the Auth0 dashboard, but I don't want to do that.

Speculation

I suspect it might be related to the upcoming changes in LinkedIn.

And it might or might not be related to discussions in another Auth0 repo, /auth0/passport-linkedin-oauth2, specifically:

Questions

What can I do to further address this? Should I just wait and hope LinkedIn solves it? Is there anything I can do on my side to makes sure this doesn't happen?


Thank you for using Lock!

Prerequisites

Environment

Please provide the following:

Reproduction

 const options = {
     allowedConnections: ['linkedin'],
     languageDictionary: {
         title: "Welcome"
     },
     auth: {
         redirectUrl: AUTH0_CONFIG.callbackUrl,
         responseType: 'token id_token',
         params: {
             scope: 'openid profile email',
             audience: AUTH0_CONFIG.apiUrl,
         }
     },
     autoclose: true,
 };
 const lock = new Auth0Lock(AUTH0_CONFIG.clientId, AUTH0_CONFIG.domain, options);
luisrudge commented 5 years ago

Hi, this doesn't look like a bug in the SDK. Please reach out to our amazing support team at https://support.auth0.com so they can better assist you with your scenario.

dandrei commented 5 years ago

You're right, this is actually LinkedIn upgrading their APIs. Auth0 has released several updates about this and it looks like the problem just went away after I opted in to the new version of the LinkedIn API.

Thanks!