Passport Facebook令牌无法在生产服务器上运行

时间:2018-06-17 04:51:43

标签: facebook passport.js feathersjs

我使用passport-facebook-token从Feathers收回JWT并在服务器端进行身份验证。在本地工作,但我在生产服务器上收到此错误:

'Strategy facebook-token is not permitted'

护照代码:

const FacebookTokenStrategy = require('passport-facebook-token');

app.passport.use('facebook-token',
        new FacebookTokenStrategy(
          {
            clientID: process.env.FACEBOOK_CLIENT_ID,
            clientSecret: process.env.FACEBOOK_CLIENT_SECRET
          },
          function(accessToken, refreshToken, profile, done) {
            app
              .service('users')
              .find({
                query: {
                  facebookId: profile.id
                }
              })
              .then(userData => {
                if (userData.data.length > 0) {
                  delete userData.data.password;
                  return done(null, userData.data[0]);
                } else {
                  app
                    .service('users')
                    .create({})
                    .then(data => {
                      return done(null, data);
                    });
                }
              });
          }
        )
      );

0 个答案:

没有答案