0

I am having trouble recently with old users. It is a scenario that is hard to test. Old users are getting errors when I try to force them to use the Enhanced Auth Dialog to add the app to their timeline. I should remark that everything works fine for new users.

Old users authenticate just fine, but if you try a timeline action, they get a #200 error saying publish_actions is needed. Which is expected. So I am trying to solve this is by 1.) checking the join_date of a user to my app. If that date is before I made the enhanced switch then 2.) I check their permissions.

If they don't have publish_actions, like so, I do this:

if(!array_key_exists('publish_actions', $permissions['data'][0]) ) {
 $gotoURL = APP_URL."?page=home";
 $cancelURL = APP_URL."?page=terms&cancel=1";
 $url = $facebook->getLoginUrl(array('canvas' => 1, 'fbconnect' => 0, 
                                     'scope' => 'publish_actions', 
                                     'redirect_uri' => $gotoURL, 
                                     'cancel_url' => $cancelURL));
 echo "<html><body><script>window.parent.location='".$url."';</script></body></html>";
 exit;
}

For some reason, that seems to put them in a redirect loop. I have the latest php sdk, so I don't really know what the issue is, and like I said, it is difficult to test. Any thoughts off hand as to what the problem/solution could be? Is there a better way to do this?

4

1 回答 1

0

他们进入重定向循环,因为这个表达式:

if(!array_key_exists('publish_actions', $permissions['data'][0]) )

总是评估为true。如果您弄清楚如何正确检查权限,它应该可以工作。

也就是说,在我的应用程序中,我从不允许发生重定向循环。如果用户不授予权限,她将被重定向到解释我们为什么请求此类权限的页面(带有返回授予权限的按钮)。如果她已经决定她不想授予应用程序权限,那么将她再次重定向到同一件事是没有意义的。

于 2012-03-07T15:15:54.040 回答