jaredhanson / passport-facebook

Facebook authentication strategy for Passport and Node.js.
https://www.passportjs.org/packages/passport-facebook/?utm_source=github&utm_medium=referral&utm_campaign=passport-facebook&utm_content=about
MIT License
1.3k stars 445 forks source link

Login doesn't work! #253

Closed JoseMontesRicardo closed 6 years ago

JoseMontesRicardo commented 6 years ago

Hi!, yesterday my Facebook login worked, but today this appeared:

captura de pantalla de 2018-09-18 13 14 11

This is my strategy

async connectionWithFacebook(token, company) {
        let connector = await this.connectorRepository.getOne({ name: this.social.facebook });
        passport.use(new this.FacebookStrategy({
            clientID: connector.config.keys.clientID,
            clientSecret: connector.config.keys.clientSecret,
            callbackURL: connector.config.keys.callbackURL,
            scope: connector.config.keys.scope,
            profileFields: connector.config.keys.profileFields,
            passReqToCallback: true
        },
            async (req, accessToken, refreshToken, profile, done) => {
                try {
                    let nameAndEmail = {}
                    nameAndEmail.name = profile._json.email;
                    nameAndEmail.displayName = profile._json.name;
                    let APIdata = this.APIFacebook(nameAndEmail, profile.id, profile.displayName, profile.username, profile.photos, accessToken);
                    if (accessToken && profile) return done(null, profile, { APIdata, accessToken, connectorId: connector._id });
                    return done(null, false, { type: 'WARNING!', message: 'Problema de autenticación!' });
                } catch (error) {
                    return done(error)
                }
            }))
    }

And this is my auth code:

Passport.authenticate('facebook', {
                scope: [
                    'ads_management',
                ],
                profile_fields: [
                    'id',
                    'email',
                    'first_name',
                    'last_name',
                    'middle_name',
                    'gender',
                    'link'
                ],
                state: req.tokenDecoded.id
                // "callbackURL" : "http://localhost:3000/connection/facebookCallback"
})
vikramkhalsa commented 6 years ago

I am having the same issue.. This is my first time trying passport..

JoseMontesRicardo commented 6 years ago

Does passport have support yet?

rwky commented 6 years ago

@JoseMontesRicardo this fork does https://github.com/passport-next/passport-facebook

JoseMontesRicardo commented 6 years ago

Thanks @rwky i am going to try it :)

JoseMontesRicardo commented 6 years ago

@rwky https://github.com/passport-next/passport-facebook did not work :(

rwky commented 6 years ago

@JoseMontesRicardo can you raise an issue there and someone will take a look.