Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FacebookToken Error via localhost #288

Open
lcy101u opened this issue Jan 27, 2022 · 2 comments
Open

FacebookToken Error via localhost #288

lcy101u opened this issue Jan 27, 2022 · 2 comments

Comments

@lcy101u
Copy link

lcy101u commented Jan 27, 2022

facebook strategy

passport.use(new FacebookStrategy({
    clientID: process.env.FACEBOOK_ID,
    clientSecret: process.env.FACEBOOK_SECRET,
    callbackURL: process.env.FACEBOOK_CALLBACK,
    profileFields: ['email', 'displayName']
  }, (accessToken, refreshToken, profile, done) => {
    console.log(profile)
    //.....
  }))

authenticate

router.get('/facebook', (req, res, next) => {
  console.log('FB authentication !!!!')
  next()
},passport.authenticate('facebook', {
  scope: ['email', 'public_profile']
}))

router.get('/facebook/callback',(req, res, next) => {
  console.log('FB callback!!!!')
  next()
},  passport.authenticate('facebook', {
  successRedirect: '/',
  failureRedirect: '/users/login',
}))

This is what I got

Listening on http://localhost:3000
mongodb connected!
FB authentication !!!!
FB callback!!!!
FacebookTokenError: Can't Load URL: The domain of this URL isn't included in the app's domains
at Strategy.parseErrorResponse (D:_Projects\todo-list\node_modules\passport-facebook\lib\strategy.js:198:12)
at Strategy.OAuth2Strategy._createOAuthError (D:_Projects\todo-list\node_modules\passport-oauth2\lib\strategy.js:420:16)
at D:_Projects\todo-list\node_modules\passport-oauth2\lib\strategy.js:177:45
at D:_Projects\todo-list\node_modules\oauth\lib\oauth2.js:191:18
at passBackControl (D:_Projects\todo-list\node_modules\oauth\lib\oauth2.js:132:9)
at IncomingMessage. (D:_Projects\todo-list\node_modules\oauth\lib\oauth2.js:157:7)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (internal/streams/readable.js:1327:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)

What I had tried

Stackoverflow

But since I use localhsot, so I left "Valid OAuth Redirect URIs" empty

Environment

  • Operating System: Window 10
  • Node version: v14.16.0
  • passport version: 0.5.2
  • passport-facebook version: 3.0.0
@blender222
Copy link

I have same problem when running in localhost.
(FacebookTokenError: Can't Load URL: The domain of this URL isn't included in the app's domains)

but it works when deploy to heroku

@lcy101u
Copy link
Author

lcy101u commented Jan 28, 2022

@blender222 Looks like it is a bug from Meta (Facebook), I tried again in localhost and it works fine now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants