Facebook 应用程序重定向出错,它不会重定向画布页面
我已经使用 Heroku 托管设置了一个 Facebook 应用程序。当未经授权的用户访问应用时,它会显示此
然后它重定向到权限页面。当我点击“转到应用程序”按钮时,它会重定向到 http://lovehunt.herokuapp.com 而不是 Facebook 画布页。
但是,如果授权用户访问应用程序,则没有问题。
下面是 FBUtils.php 中编写的代码片段
public static function login($redirect) {
$app_id = AppInfo::appID();
$app_secret = AppInfo::appSecret();
$home = AppInfo::getHome();
$scope = 'user_likes,user_photos,user_photo_video_tags';
$authorize_url = "https://www.facebook.com/dialog/oauth?client_id=$app_id" .
"&redirect_uri=$home&state=" . $state . "&scope=$scope";
// Now we redirect the user to the login page
echo("<script> window.top.location='" . $authorize_url . "'</script>");
}
I have set up a Facebook app using Heroku hosting. When unauthorized user goes to app it shows this
and then it redirects to the permissions page . When I click to Go to App button it redirects to http://lovehunt.herokuapp.com not to Facebook canvas page.
However if an authorized user goes to app there is no problem.
below is the code snippet which is written in FBUtils.php
public static function login($redirect) {
$app_id = AppInfo::appID();
$app_secret = AppInfo::appSecret();
$home = AppInfo::getHome();
$scope = 'user_likes,user_photos,user_photo_video_tags';
$authorize_url = "https://www.facebook.com/dialog/oauth?client_id=$app_id" .
"&redirect_uri=$home&state=" . $state . "&scope=$scope";
// Now we redirect the user to the login page
echo("<script> window.top.location='" . $authorize_url . "'</script>");
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是您尝试对 facebook 进行 iframe 的典型屏幕,因为 facebook 本身不允许它进行 iframe,所以它会提供此页面
因此,请使用不尝试 iframe 的代码进行设置,可能会使用某些东西,如果是 javascript 的情况:
这篇文章适用于上述内容: Facebook 应用第一次使用时重定向到托管网址
This is typical screen that you try to iframe facebook, as facebook does not let it be iframed itself it gives this page
So set up with your code that does not try to iframe, probably use something, if it is case with javascript:
this post applies for above: facebook apps redirect to hosting url in the first usage