0

I use IBM Cloud App ID' and I want to use LinkedIn as a provider. However, "InternalOAuthError" occurs at the time of app approving.

There is a sample on the IBM Cloud blog.
Sign In Your App Users With Any Identity Provider Using App ID
I tried the sample app along this flow. Login to LinkedIn seems to have succeeded, but the following error occurred when app was approved.

InternalOAuthError: failed to fetch user profile
    at _oauth2.get (C:\xxx\AppIdCustomIdentity\node_modules\passport-linkedin-oauth2\lib\oauth2.js:70:23)
    at passBackControl (C:\xxx\AppIdCustomIdentity\node_modules\oauth\lib\oauth2.js:132:9)
    at IncomingMessage.<anonymous> (C:\xxx\AppIdCustomIdentity\node_modules\oauth\lib\oauth2.js:157:7)
    at IncomingMessage.emit (events.js:187:15)
    at endReadableNT (_stream_readable.js:1094:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

Please help!!



When I tried this post,"InternalOAuthError" no longer occurs. But another error has occurred.

Error: Failed to obtain tokens
    at Request.request [as _callback] (C:\xxx\AppIdCustomIdentity\node_modules\ibmcloud-appid\lib\token-manager\token-manager.js:118:13)
    at Request.self.callback (C:\xxx\AppIdCustomIdentity\node_modules\request\request.js:185:22)
    at Request.emit (events.js:182:13)
    at Request.<anonymous> (C:\xxx\AppIdCustomIdentity\node_modules\request\request.js:1161:10)
    at Request.emit (events.js:182:13)
    at IncomingMessage.<anonymous> (C:\xxx\AppIdCustomIdentity\node_modules\request\request.js:1083:12)
    at Object.onceWrapper (events.js:273:13)
    at IncomingMessage.emit (events.js:187:15)
    at endReadableNT (_stream_readable.js:1094:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

2 Answers2

1

As suggested in this post (https://stackoverflow.com/a/56329029/10422503), looks like the passport-linkedin-oauth2 library has not been updated for the LinkedIn 2.0 APIs. Try using the fork suggested there

iceman
  • 41
  • 2
  • Thank you for your help.When I tried, "InternalOAuthError" did not occur anymore. But another error has occurred.`Failed to obtain tokens`This is an error from ibmcloud-appid's token-manager. – FUJI Minamihara Jun 06 '19 at 07:56
  • If you are using the App ID v4 endpoints, using the latest SDK (6.0.0 and above) should solve the `Error: Failed to obtain tokens` – iceman Jun 06 '19 at 14:17
  • I checked the version of ibmcloud-appid, but it was the latest(6.0.0). Do not know other possible causes? – FUJI Minamihara Jun 07 '19 at 05:24
0

Looking at the stack trace it looks like the exception is coming from passport-linkedin-oauth2 module.

at _oauth2.get (C:\xxx\AppIdCustomIdentity\node_modules\passport-linkedin-oauth2\lib\oauth2.js:70:23)

Googling for InternalOAuthError: failed to fetch user profile +linkedin gives a few options you might want to try.

Anton
  • 3,166
  • 1
  • 13
  • 12
  • Per this recent discussion at [GitHub](https://github.com/auth0/passport-linkedin-oauth2/issues/24),Specified a specific profileField and scope.I tried, but I got the same error. – FUJI Minamihara Jun 06 '19 at 01:02