从移动浏览器登录 facebook 时出错

Error in facebook login from mobile browser

我正在尝试在 nodejs 中使用 "react-facebook-login" 和 "passport-facebook-token" 通过 Facebook 登录。 我在 Web 浏览器中成功登录,但在移动浏览器中出现错误 "URL Bloocked"。 当我在 phone 上切换到桌面模式时,它成功登录了。

const module.exports = passport => {
passport.use(
"facebookStrategy",
new FacebookStrategy(
  {
    clientID: *****,
    clientSecret: "*****",
  },
  (accessToken, refreshToken, profile, done) => {
    User.findOne({ email: profile.emails[0].value })
      .then(user => {
        if (user) {
          return done(null, user);
        } else {
          //create new profile
          const newProfile = new Profile({
            user: newUser.id,
            username: profile.displayName,
            email: profile.emails[0].value,
            profilepic: profile.photos[0].value
          });
          newProfile
            .save()
            .catch(err =>
              console.log("Error in creating new profile " + err)
            );
          return done(null, newProfile);
        }
      })
      .catch(err => console.log(err));
  }
)

); };

这是移动浏览器中的常见问题,您会发现某些 android 设备中也会出现此问题。

为预防起见,最佳做法是手动构建登录流程。到这里 https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow

所以是的,您将需要进行手动集成。但是,这将是 full-proof 毫无疑问的整合。