React-facebook-login 在桌面浏览器上工作,但在移动设备上抛出“URL 被阻止:此重定向失败,因为重定向 URI 未列入白名单”

Aar*_*ron 1 facebook oauth facebook-graph-api reactjs

我的网络应用程序stockbets.io使用 Facebook 登录进行 oauth。在桌面网络浏览器上,这工作正常,并且我的试点用户在登录时都没有遇到任何问题。但是,当他们在移动设备上尝试完全相同的流程时,我们收到此错误:

\n
URL Blocked: This redirect failed because the redirect URI is not whitelisted in the app\xe2\x80\x99s Client OAuth Settings. Make sure Client and Web OAuth Login are on and add all your app domains as Valid OAuth Redirect URIs.\n
Run Code Online (Sandbox Code Playgroud)\n

这是我的 Facebook 登录服务设置面板的快照:

\n

在此输入图像描述

\n

这看起来应该很简单,但我不知道为什么这适用于桌面而不是移动设备。如果您想测试,预期的行为是您应该收到一条消息,说明该产品处于早期测试阶段,但如果您想提前访问,请向我们发送电子邮件。目前发生的情况就是上面的错误信息。

\n

有小费吗?

\n

jmz*_*z7v 7

根据 GitHub 的说法,这似乎与react-facebook-login库有关。根据GitHub 上的类似帖子...看起来您只需要确保将以下 props 添加到您的 React 组件中。

<FacebookLogin
  appId="13xxxxxxxxxxx09"//TODO: Replace yours...
  autoLoad={false}
  fields="first_name, last_name ,email, picture"
  callback={(resp)=>this.responseFacebook(resp)}//TODO: Replace your callback
  cssClass="fbtn"
  disableMobileRedirect={true}
/>   
Run Code Online (Sandbox Code Playgroud)