开发者

In Facebook FB.ui (method: permissions.request) user is not redirect to proper location

开发者 https://www.devze.com 2023-02-11 19:36 出处:网络
Hi i m trying to show permission dialog using following code: $permission = $facebook->api(array(\'method\' =>\'users.hasAppPermission\',\'ext_perm\'=>\'publish_stream\',\'uid\'=> $uid));

Hi i m trying to show permission dialog using following code:

$permission = $facebook->api(array('method' =>'users.hasAppPermission','ext_perm'=>'publish_stream','uid'=> $uid));

if($permission != '1')
{
   e开发者_运维百科cho "<script type='text/javascript'>
     var dialog = {
        method: 'permissions.request',
        perms: 'publish_stream',
        redirect_uri: 'http://apps.facebook.com/abcd/'
        };  
    FB.ui(dialog,null);
    </script>";
}

This code works fine but problem is that when user allow to permissions he is not redirected to redirect_uri location(that is my canvas page) instead it goes to canvas url (that is my server's url). how to solve this problem Help me.


You can add the following javascript code in your page:

FB.Event.subscribe('auth.sessionChange', function(response) {
    if (response.session) {
      window.location.href = '/whatever/here';
    } else {
      // The user has logged out, and the cookie has been cleared
    }
});
0

精彩评论

暂无评论...
验证码 换一张
取 消