我一直在尝试获取网站的基本OAuth流程登录信息。 clientID,secret和callback URI都可以使用,但是只有当我第二本护照才开始失败。对交换令牌进行身份验证。
Error at C:\Users\denze\Desktop\personalSite\node_modules\passport-facebook\lib\strategy.js:165:21 at passBackControl (C:\Users\denze\Desktop\personalSite\node_modules\oauth\lib\oauth2.js:132:9) at IncomingMessage. (C:\Users\denze\Desktop\personalSite\node_modules\oauth\lib\oauth2.js:157:7) at emitNone (events.js:91:20) at IncomingMessage.emit (events.js:185:7) at endReadableNT (_stream_readable.js:974:12) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9)
const router = require('express').Router()
const passport = require('passport')
const FacebookStrategy = require('passport-facebook').Strategy
passport.use(
new FacebookStrategy({
clientID: someId,
clientSecret: someSecret,
callbackURL: 'https://289abc65.ngrok.io/auth/redirect',
profileFields: ['email']
}, function(token, refreshToken, profile, done) {
// asynchronous
process.nextTick(function() {
})
console.log(profile)
})
);
router.get('/login',passport.authenticate('facebook',
{ scope : ['email']
}))
router.get('/redirect',
passport.authenticate('facebook', {
successRedirect : '/',
failureRedirect : '/'
}));
module.exports = router;
! https://imgur.com/a/RApy8xq Facebook API设置