简体   繁体   English

Facebook 画布 PHP SDK getLoginUrl

[英]Facebook canvas PHP SDK getLoginUrl

i am runnig a site with PHP-SDK connection to the Facebook.我正在运行一个带有 PHP-SDK 连接到 Facebook 的站点。 I can figure out, what is wrong:我可以弄清楚,出了什么问题:

  1. New user comes to the mysite url and uses a button to log in using facebook.新用户来到 mysite url 并使用按钮使用 Facebook 登录。
  2. Facebook asks for permisions. Facebook 要求获得许可。 User accepts.用户接受。
  3. All i sok.所有我索取。

But:但:

  1. New user comes to the Facebok Canvas application and uses a button to log in using facebook (I do not use the Javascript and donť want to.).新用户来到 Facebok Canvas 应用程序并使用一个按钮来使用 facebook 登录(我不使用 Javascript 并且不想使用。)。
  2. Nothing happens, it seems that facebook calls the url (getLoginUrl) but it doesn't show the page, where user can allow the permission.没有任何反应,似乎 facebook 调用了 url (getLoginUrl),但它没有显示用户可以允许权限的页面。

I use:我用:

  $params = array(
              'canvas' => 1,
              'fbconnect' => 0,
              'scope' => 'user_about_me, email, publish_stream, read_stream',
              'redirect_uri' => http:/my_domain.com,
              'display' => 'page'
            );
   $loginUrl = $facebook->getLoginUrl($params);

I tried to use:我尝试使用:

             'redirect_uri' => 'http://apps.facebook.com/app_namespace/',

But it doesn't work, either.但它也不起作用。 Anybody any ideas?有人有什么想法吗?

Thanks a lot...非常感谢...

EDITED: I tried to use javascript: top.location.href = ... it works, but only if I use as redirect_uri - htttp://domain.com, so the user is no longer in facebook canvas application :( I think it is possible that I use it wrong way...编辑:我尝试使用 javascript: top.location.href = ... 它有效,但前提是我使用作为redirect_uri - htttp://domain.com,所以用户不再在 facebook 画布应用程序中:( 我认为有可能我用错了方法...

如果您将重定向 uri 设置为画布 URL,您可以获得用户的访问令牌

$facebook->getSignedRequest();

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

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