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

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. #260

Open
YiJingLin opened this issue Jun 5, 2019 · 1 comment

Comments

@YiJingLin
Copy link

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?

@ghost
Copy link

ghost commented Jul 7, 2019

Please Mention your Facebook ID and Facebook app secret

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

1 participant