护照js FacebookTokenError

时间:2019-12-30 11:43:27

标签: javascript reactjs facebook passport.js

我尝试了一切,但每次都会收到此错误:(翻译为谷歌翻译)

FacebookTokenError: URL cannot be loaded: The domain of this URL does not exist in the domains of the app. To be able to load this URL, add all domains and subdomains to your app in the appdomain field in your app settings.
    at Strategy.parseErrorResponse (/usr/src/app/node_modules/passport-facebook/lib/strategy.js:198:12)
    at Strategy.OAuth2Strategy._createOAuthError (/usr/src/app/node_modules/passport-oauth2/lib/strategy.js:405:16)
    at /usr/src/app/node_modules/passport-oauth2/lib/strategy.js:175:45
    at /usr/src/app/node_modules/oauth/lib/oauth2.js:191:18
    at passBackControl (/usr/src/app/node_modules/oauth/lib/oauth2.js:132:9)
    at IncomingMessage. <anonymous> (/usr/src/app/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: 139: 11)
    at process._tickCallback (internal / process / next_tick.js: 181: 9)

这是我的代码:

passport.use(new FacebookStrategy({
    clientID: "XXX",
    clientSecret: "XXX",
    callbackURL: '/return'
  },
  function(accessToken, refreshToken, profile, cb) {
    return cb(null, profile);
  }));

router.get('/login/facebook',
  passport.authenticate('facebook'));

router.get('/return', 
  passport.authenticate('facebook', { failureRedirect: '/login' }),
  function(req, res) {
    console.log("Test")
    res.redirect('/');
  });

这是我的设置

enter image description here

enter image description here

enter image description here

我不知道该怎么办。有人可以帮助我吗? 您可以在localmelodies.com上对其进行测试,然后单击注册并输入用户名和城市,然后有Facebook登录按钮。

  • 操作系统:linux
  • 节点版本:8.10.0
  • 护照版本:0.4.1
  • passport-facebook版本:3.10.10

0 个答案:

没有答案