Login Failed: You can't use Facebook to log into this app or website because there's an issue with its implementation of Facebook Login.
YiJingLin opened this issue · 1 comments
Hi!
I cannot currently login using passport-facebook.
When redirecting to Facebook, I end up on this URL (the redirect_uri
is correct, I double checked):
https://www.facebook.com/v3.2/dialog/oauth?response_type=code&redirect_uri=https%3A%2F%MYDOMAIN.COM%2FAuth%2Ffacebook%2Fcallback&scope=public_profile%2Cemail&client_id=XX
On that URL, Facebook tells me the following error message:
Error message: Login Failed: You can't use Facebook to log into this app or website because there's an issue with its implementation of Facebook Login.
I am using passport
v0.4.0 and passport-facebook
v3.0.0.
This is my code:
FacebookStrategy = require('passport-facebook').Strategy;
authRouter = express.Router();
passport.serializeUser(function(user, done) {
done(null, user && user.uid || user);
});
// used to deserialize the user
passport.deserializeUser(function(id, done) {
console.error('id');
done(null, id);
});
console.log("facebookCallbackUrl", facebookCallbackUrl);
passport.use(new FacebookStrategy({
clientID: facebookAppId,
clientSecret: facebookAppSecret,
callbackURL: facebookCallbackUrl,
profileFields: ['id', 'email', 'first_name', 'last_name'],
passReqToCallback : true
},
function(req, accessToken, refreshToken, profile, done) {
process.nextTick(function() {
var authData = {
facebookID: profile.id,
facebookToken: accessToken,
userName: profile.name.familyName + ' ' + profile.name.givenName,
preferredLocale: profile._json && profile._json.locale && profile._json.locale.replace('_', '-')
};
console.log(authData.facebookID);
console.log(authData.facebookToken);
console.log(authData.userName);
Instance.User.tryLogin(authData)
.then(function(user) {
done(null, user);
})
.catch(function(err) {
done(err, null);
});
});
}));
appRouter.use(passport.initialize());
authRouter.use(function(req, res, next) {
console.error("[Facebook Request]", req.url);
next();
});
authRouter.get('/facebook',
passport.authenticate('facebook', {scope: ['public_profile', 'email']}));
authRouter.get('/facebook/callback',
passport.authenticate('facebook', {
successRedirect: '/',
failureRedirect: '/Guest'
}));
authRouter.get('/facebookCanvas', passport.authenticate('facebook', {scope: ['public_profile', 'email']}));
authRouter.get('/facebookCanvas/callback',
passport.authenticate('facebook', {
successRedirect: '/Notification',
failureRedirect: '/Guest'
}));
appRouter.use(authPath, authRouter);
Any suggestions or ideas as to what could be going wrong?
Please Mention your Facebook ID and Facebook app secret