简体   繁体   English

使用通行证linkedin策略时出现InternalOAuthError

[英]InternalOAuthError when using passport-linkedin strategy

I'm working with passport-linkedin and I'm getting this error. 我正在与通行证护照一起工作,但出现此错误。

InternalOAuthError: failed to obtain request token
    at /Users/davey/code/node/appify-frontend/node_modules/passport-linkedin/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth.js:196:36
    at /Users/davey/code/node/appify-frontend/node_modules/passport-linkedin/lib/passport-linkedin/strategy.js:80:19
    at passBackControl (/Users/davey/code/node/appify-frontend/node_modules/passport-linkedin/node_modules/passport-oauth/node_modules/oauth/lib/oauth.js:397:13)
    at IncomingMessage.<anonymous> (/Users/davey/code/node/appify-frontend/node_modules/passport-linkedin/node_modules/passport-oauth/node_modules/oauth/lib/oauth.js:409:9)
    at IncomingMessage.emit (events.js:129:20)
    at _stream_readable.js:908:16
    at process._tickCallback (node.js:355:11)
GET /oauth/linkedin 500 1074ms - 786b

Here's what my setup looks like 这是我的设置

exports.setup = function (config) {
  var passport = require('passport');
  var LinkedinStrategy = require('passport-linkedin').Strategy;

  passport.use(new LinkedinStrategy({
      consumerKey: config.linkedin.clientID,
      consumerSecret: config.linkedin.clientSecret,
      callbackURL: config.linkedin.callbackURL
    },
    function(token, tokenSecret, profile, done) {
      console.log(token, tokenSecret, profile);
      return done(null, true);
    }
  ));
};

and my routing setup is as follows 我的路由设置如下

router
    .get('/', 
        function(req, res, next) {
            console.log("[OAuth2:redirect:query]:", JSON.stringify(req.query));
            console.log("[OAuth2:redirect:body]:", JSON.stringify(req.body));
            next();
          },
        passport.authenticate('linkedin', {
        failureRedirect: '/settings/connected-accounts',
        session: false
    }))

    .get('/callback', passport.authenticate('linkedin', {
        failureRedirect: '/settings/connected-accounts',
        session: false
    }), function (req, res){
        res.redirect('/settings/connected-accounts');
    });

In the same app, I've setup twitter and facebook oauth, both of which work very well. 在同一个应用程序中,我设置了twitter和facebook oauth,它们都工作得很好。 I have no idea what's causing this error and have tried everything. 我不知道是什么导致了此错误,并已尝试了所有方法。

In my linkedin developer account, I've configured everything as should be. 在我的linkedin开发人员帐户中,我已经按需配置了所有内容。

Authorized Redirect URLs: 授权重定向网址:

http://testdomain.ngrok.io/oauth/linkedin/callback

Default "Accept" Redirect URL: 默认的“接受”重定向URL:

http://testdomain.ngrok.io/settings/connected-accounts

I first used a localhost url running on port 9000, but when that failed, I exposed my app running locally to a live url, but I still had the same error. 我首先使用了在端口9000上运行的localhost url,但是当失败时,我将在本地运行的应用程序暴露给了实时url,但是仍然遇到相同的错误。 Any help is appreciated. 任何帮助表示赞赏。 Thanks 谢谢

The InternalOAuthError is related to passport-oauth1 ( https://github.com/jaredhanson/passport-linkedin/blob/master/lib/strategy.js ) , but you use OAuth2 according to your routing setup. InternalOAuthError与password-oauth1( https://github.com/jaredhanson/passport-linkedin/blob/master/lib/strategy.js )有关,但是您可以根据路由设置使用OAuth2。 So try switching to passport-linkedin-oauth2 因此,请尝试切换至Passport-linkedin-oauth2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 护照-linkedin回调不起作用 - passport-linkedin callback does not work 快递护照-linkedin,提出api请求 - express passport-linkedin, making api requests 使用nodejs护照集成第三方平台时出现InternalOAuthError - InternalOAuthError when using nodejs passport to integration third party platform InternalOAuthError:在实施 twitter 策略时无法使用 express 和 passport js 获取用户配置文件 - InternalOAuthError: failed to fetch user profile using express and passport js while implementing twitter strategy CORS Passport LinkedIn 策略错误 - CORS error with Passport LinkedIn Strategy NestJS:护照 LinkedIn 策略与 graphql - NestJS : Passport LinkedIn strategy with graphql 使用passport和Google API进行身份验证时出现问题 - 正在发生InternalOAuthError - Problems with authentication using passport and google API - InternalOAuthError is occurring 使用OAuth 1.0a API向LinkedIn进行身份验证的护照策略在保存用户时返回未定义的电子邮件 - Passport strategy for authenticating with LinkedIn using the OAuth 1.0a API return undefined email on save User 使用OAuth 2.0a API向LinkedIn进行身份验证的护照策略在保存用户时返回未定义的电子邮件 - Passport strategy for authenticating with LinkedIn using the OAuth 2.0a API return undefined email on save User 不使用会话时Passport.js策略失败 - Passport.js strategy fails when not using session
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM