检索 Linkedin 用户的信息

Retrieve Linkedin user’s information

我目前正在开发一个 NodeJS 应用程序,我打算检索 Linkedin 用户的经验、教育和技能。这样做时,我收到以下错误。我怎样才能避免这个错误?

这是导致错误的工作流程:http://3.14.113.64:4000/

InternalOAuthError: failed to fetch user profile
at _oauth2.get (/linkedin-connection/node_modules/passport-linkedin-oauth2/lib/oauth2.js:70:23)
at passBackControl (/linkedin-connection/node_modules/oauth/lib/oauth2.js:132:9)
at IncomingMessage.<anonymous> (/linkedin-connection/node_modules/oauth/lib/oauth2.js:157:7)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)

看起来这是这个库的一个已知问题: https://github.com/auth0/passport-linkedin-oauth2/issues/75

this module that has not been updated to linkedin API 2.0 as reported in this issue

将此切换为 fork:

npm install @sokratis/passport-linkedin-oauth2

并替换 require / import 语句:

var LinkedInStrategy = require('@sokratis/passport-linkedin-oauth2').Strategy;