[英]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.