简体   繁体   English

Facebook应用重定向中的错误,它不会重定向画布页面

[英]Error in Facebook app redirection, it doesn't redirects canvas page

I have set up a Facebook app using Heroku hosting. 我已经使用Heroku托管设置了一个Facebook应用。 When unauthorized user goes to app it shows this 当未经授权的用户转到应用程序时,将显示此信息

Facebook徽标 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. 当我单击“转到应用程序”按钮时,它将重定向到http://lovehunt.herokuapp.com,而不是Facebook画布页面。

However if an authorized user goes to app there is no problem. 但是,如果授权用户访问应用程序,则没有问题。

below is the code snippet which is written in FBUtils.php 下面是用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>");
 }

When unauthorized user goes to app it shows this 当未经授权的用户转到应用程序时,将显示此信息

This is typical screen that you try to iframe facebook, as facebook does not let it be iframed itself it gives this page 这是您尝试内陷Facebook的典型屏幕,因为Facebook本身不会对其进行修饰,因此会显示此页面

So set up with your code that does not try to iframe, probably use something, if it is case with javascript: 因此,如果您使用的是javascript,请设置不会尝试iframe的代码,可能要使用一些东西:

_target="top" 

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. 当我单击“转到应用程序”按钮时,它将重定向到http://lovehunt.herokuapp.com,而不是Facebook画布页面。

this post applies for above: facebook apps redirect to hosting url in the first usage 这篇文章适用于以上情况: facebook应用在首次使用时重定向到托管网址

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

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