简体   繁体   English

使用getLoginUrl()的Facebook PHP SDK问题

[英]Facebook PHP SDK problem with getLoginUrl()

I am having a trouble with PHP SDK logging in using getLoginUrl(). 我在使用getLoginUrl()登录PHP SDK时遇到麻烦。 when the user click the link generated by that function it does not show the permission dialog instead it shows a facebook logo you must click it before showing the permission dialog please help me! 当用户单击该功能生成的链接时,它不会显示权限对话框,而是显示一个Facebook徽标,您必须在显示权限对话框之前单击它,请帮助我!

The Facebook logo is showing because your app is attempting to load the auth-dialog within the iframe, which is not allowed by OAuth 2.0. 之所以显示Facebook徽标,是因为您的应用正在尝试在iframe中加载身份验证对话框,而OAuth 2.0不允许这样做。 Instead your app must load the auth-dialog in the _parent or _top or in pop-out-window which is what happens when you click on the Facebook logo. 相反,您的应用程序必须在_parent或_top或弹出窗口中加载身份验证对话框,这是您单击Facebook徽标时发生的情况。

The answer will depend on how your app allow users to start the authentication process. 答案将取决于您的应用如何允许用户启动身份验证过程。

An example many have is: 许多人的例子是:

  1. user arrives at your app and is not registered with it. 用户到达您的应用且未向其注册。
  2. they have to click a link to begin the registration (authentication) process. 他们必须单击链接才能开始注册(身份验证)过程。
  3. clicking the link shows the facebook logo. 单击链接显示facebook徽标。 clicking the facebook logo shows the authentication dialog. 单击facebook徽标将显示身份验证对话框。

Most people complain that step 3 has the "extra" step of showing the facebook logo. 大多数人抱怨步骤3具有显示Facebook徽标的“额外”步骤。

ANSWER: Change your link: 解答:更改您的链接:

FROM: <a href="<?=$loginUrl?>"> FROM: <a href="<?=$loginUrl?>">

TO: <a target="_top" href="<?= $loginUrl ?> <a target="_top" href="<?= $loginUrl ?><a target="_top" href="<?= $loginUrl ?>

[there are several ways to accomplish what you are asking, this answer shows the one people seem to ask about the most, you would need to provide more details if this does not apply] [有几种方法可以完成您要问的问题,此答案表明一个人似乎最想问的问题,如果不适用,您需要提供更多详细信息]

与大多数oAuth一样,Facebook不允许用户通过iframe登录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM