Reputation: 1082
I created express api server, which runs on localhost:5000 with react app running on localhost:3000. Now I'm trying to integrate facebook authentication.
I followed Scotch's tutorial about authenticatation using passport in order to integrate facebook authentication in my own app. I have cloned his repo, set up facebook login on facebook developers and it works correctly. Using his example I've tried to set up this flow in my app, but with no success. In firefox console I noticed one diffreance - when I click "login with facebook" in scotch's app, there are 3 requests:
In my app:
So there is a difference in third request - Scotch is redirect to his callback, but in my app I got a link to message
The parameter app_id is required
on facebook page.
How should I configure react to make it work?
Upvotes: 0
Views: 1269
Reputation: 481
Do you have redirect route in your express app yet? Something like this.
app.get('/auth/facebook/callback',
passport.authenticate('facebook', { failureRedirect: '/login' }),
function(req, res) {
// Successful authentication, redirect home.
res.redirect('/');
});
You can read the documentation here https://github.com/jaredhanson/passport-facebook#readme if you are still stuck. Hope it helps
Upvotes: 0