认证后如何重定向到canvas页面?
我是菜鸟,我需要一些帮助。我刚刚创建了第一个简单的应用程序,但遇到了问题。如果用户第一次打开此应用程序并单击身份验证页面上的“允许”按钮,它将跳转到存储我的应用程序的站点,而不是应在 iframe 中显示的画布页面。
该应用程序的网址是 https://apps.facebook.com/kpxyapp/
(我删除了 appid 并来自下面的代码的秘密。)
如果您能提供帮助,我将不胜感激。谢谢。
<?php
require 'src/facebook.php';
$facebook = new Facebook(array(
'appId' => '',
'secret' => '',
));
$user = $facebook->getUser();
if ($user) {
$me = $facebook->api('/me');
echo "Hello my name is : {$me['name']}";
} else {
$loginUrl = $facebook->getLoginUrl();
echo "<script>top.location.href=\"{$loginUrl}\"</script>";
}
?>
I am a noob and I need some help. I just created my first simple app and I ran into an problem. If a user opens this app for the first time and clicks on the 'allow' button on the authentication page, it jumps to the site where my app is stored and not to the canvas page where it should be displayed in iframe.
The app's url is https://apps.facebook.com/kpxyapp/
(I removed the appid and secret from the code below.)
I would be grateful if you could help. Thanks.
<?php
require 'src/facebook.php';
$facebook = new Facebook(array(
'appId' => '',
'secret' => '',
));
$user = $facebook->getUser();
if ($user) {
$me = $facebook->api('/me');
echo "Hello my name is : {$me['name']}";
} else {
$loginUrl = $facebook->getLoginUrl();
echo "<script>top.location.href=\"{$loginUrl}\"</script>";
}
?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也尝试了很多次,终于找到了另一篇文章,它引导我http://thinkdiff.net/facebook/graph-api-iframe-base-facebook-application-development-php-sdk-3-0/。它确实帮助我解决了问题。
祝你好运 !
I have been trying this a lot too, finally found another post which directed me to http://thinkdiff.net/facebook/graph-api-iframe-base-facebook-application-development-php-sdk-3-0/. It really helped me solve the problem.
Good Luck !