简体   繁体   中英

Facebook PHP SDK problem with getLoginUrl()

I am having a trouble with PHP SDK logging in using getLoginUrl(). 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!

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. 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.

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. clicking the facebook logo shows the authentication dialog.

Most people complain that step 3 has the "extra" step of showing the facebook logo.

ANSWER: Change your link:

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

TO: <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登录。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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