我在OAoku中部署的所有MEAN app URL在OAuth Redirect URIs facebook登录设置中被Facebook识别为恶意和/或滥用

时间:2018-04-20 02:22:11

标签: facebook heroku passport-facebook

我一直在开发 MEAN应用程序(Mongo,Express,Angular,Node )并添加了Facebook Oauth 2.0。我成功添加了Facebook Oauth登录,之前它正常工作但突然我的Heroku URL在OAuth Redirect URIs facebook登录设置中被删除,并且突然被视为恶意和/或滥用。

使用Passport Facebook添加Facebook Oauth 2.0并重定向 在当地工作(http://127.0.0.1:3001/client/auth/facebook/callback)。我已经就这个问题联系了facebook,但它仍然没有用。

我一直想知道在将 Heroku 添加到脸谱OAuth重定向URI时,或者 Passport Facebook oauth 2.0 中是否存在错误?

我的facebook护照代码是

passport.use('facebook.client', new FacebookStrategy({
// pull in our app id and secret from our auth.js file
clientID          : configAuth.facebookAuth.clientID,
clientSecret      : configAuth.facebookAuth.clientSecret,
callbackURL       : configAuth.facebookAuth.callbackURLOnline,
profileFields     : ["emails", "displayName", "name","timezone", "gender", "profileUrl"],
},
// facebook will send back the token and profile
(token, refreshToken, profile, done) => {
// asynchronous
process.nextTick(() => {
    // find the user in the database based on their facebook id
    Client.findOne({ 'facebook.id': profile.id }, (err, client) => {

        // if there's an error connecting to the database
        if (err)
            return done(err);
        // if the user is found, then log them in
        if (client) {
            return done(null, client); // user found, return that user
        } else {
            // if there is no user found with that facebook id, create them
            var newClient = new Client();
            // set all of the facebook information in our user model
            newClient.facebook.id         = profile.id; 
            newClient.facebook.token      = token; 
            newClient.facebook.name       = `${profile.name.givenName} ${profile.name.familyName}`; 
            newClient.facebook.email      = profile.emails[0].value; 
            newClient.facebook.profileUrl = profile.profileUrl; 
            newClient.facebook.gender     = profile.gender; 

            // save our user to the database
            newClient.save(err => {
                if (err){
                    console.log(err);
                    throw err;
                }
                return done(null, newClient);
            });
        }
    });
});
}));

0 个答案:

没有答案