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

Posted

技术标签:

【中文标题】从移动浏览器登录 Facebook 时出错【英文标题】:Error in facebook login from mobile browser 【发布时间】:2019-10-12 21:08:02 【问题描述】:

我正在尝试使用 nodejs 中的“react-facebook-login”和“passport-facebook-token”通过 Facebook 登录。 我在 Web 浏览器中成功登录,但在移动浏览器中收到错误“URL Blocked”。 当我在手机上切换到桌面模式时,它成功登录。

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));
  
)

); ;

【问题讨论】:

请检查这是否有帮助***.com/questions/37001004/… 【参考方案1】:

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

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

所以是的,您需要手动集成。但是,毫无疑问,这将是全面的集成。

【讨论】:

以上是关于从移动浏览器登录 Facebook 时出错的主要内容,如果未能解决你的问题,请参考以下文章

Facebook 登录无法在移动设备上使用(但可以在桌面设备上使用)

Hybridauth Facebook 使用本机应用程序在移动设备上登录

禁用 Facebook 移动浏览器检测?

如何通过浏览器重定向打开移动应用程序(例如 Facebook)?

从移动设备登录 Spring Security、Rest api 和 Facebook

使用移动托管 API 的 Facebook 应用链接