InternalOAuthError:无法获取访问令牌

任何人都可以帮助我与下面的代码链接GitHub oauth2提供服务器与passport-oauth2消费者

在我用http://localhost:8082login后,到达我的callbackURL: http://localhost:8081/auth/provider/callback ,它会抛出一个错误

 var express = require('express') , passport = require('passport') , util = require('util') , TwitterStrategy = require('passport-twitter').Strategy; var TWITTER_CONSUMER_KEY = "--insert-twitter-consumer-key-here--"; var TWITTER_CONSUMER_SECRET = "--insert-twitter-consumer-secret-here--"; passport.serializeUser(function(user, done) { done(null, user); }); passport.deserializeUser(function(obj, done) { done(null, obj); }); passport.use(new TwitterStrategy({ consumerKey: TWITTER_CONSUMER_KEY, consumerSecret: TWITTER_CONSUMER_SECRET, callbackURL: "http://127.0.0.1:3000/auth/twitter/callback" }, function(token, tokenSecret, profile, done) { // asynchronous verification, for effect... process.nextTick(function () { return done(null, profile); }); } )); var app = express.createServer(); // configure Express app.configure(function() { app.set('views', __dirname + '/views'); app.set('view engine', 'ejs'); app.use(express.logger()); app.use(express.cookieParser()); app.use(express.bodyParser()); app.use(express.methodOverride()); app.use(express.session({ secret: 'keyboard cat' })); app.use(passport.initialize()); app.use(passport.session()); app.use(app.router); app.use(express.static(__dirname + '/public')); }); app.get('/', function(req, res){ res.render('index', { user: req.user }); }); app.get('/account', ensureAuthenticated, function(req, res){ res.render('account', { user: req.user }); }); app.get('/login', function(req, res){ res.render('login', { user: req.user }); }); app.get('/auth/twitter', passport.authenticate('twitter'), function(req, res){ // The request will be redirected to Twitter for authentication, so this // function will not be called. }); app.get('/auth/twitter/callback', passport.authenticate('twitter', { failureRedirect: '/login' }), function(req, res) { res.redirect('/'); }); app.get('/logout', function(req, res){ req.logout(); res.redirect('/'); }); app.listen(3000); function ensureAuthenticated(req, res, next) { if (req.isAuthenticated()) { return next(); } res.redirect('/login') } 

InternalOAuthError:无法获取访问令牌

我该如何解决这个问题?

       

网上收集的解决方案 "InternalOAuthError:无法获取访问令牌"