在 FB.ui 中,使用方法 requests.request 重定向 uri 无法正常工作
您好,我最近首先修改了我的申请,它只需要基本信息。来自用户的许可,但现在我也想要流发布许可。因此,我检查我的索引页面,如果用户未授予流发布权限,我只是向他显示权限对话框,如下所示:
<?php $permission = $facebook->api(array('method' => 'users.hasAppPermission','ext_perm'=>'publish_stream','uid'=> $uid));
if($permission != '1')
{
echo "<script type='text/javascript'>
var dialog = {
method: 'permissions.request',
perms: 'publish_stream'
};
FB.ui(dialog,null);
</script>";
}
?>
此代码正确显示权限框,但问题是,当用户授予权限时,他会重定向到我的画布网址(服务器页面上的网址) )而不是在画布页面上(即 http://apps.facebook.com/xyz)。为了解决这个问题,我向其中添加了redirect_uri,
var dialog = {
method: 'permissions.request',
perms: 'publish_stream',
redirect_uri: 'http://apps.facebook.com/xyz'
};
但它仍然不起作用。
请帮助我如何解决这个问题。
Hi I modify my application recently first it just takes basic info. permission from users but now I want stream publish permission too. So I check on my index page if users not granted stream publish permission I just show him permission dialog box as follows:
<?php $permission = $facebook->api(array('method' => 'users.hasAppPermission','ext_perm'=>'publish_stream','uid'=> $uid));
if($permission != '1')
{
echo "<script type='text/javascript'>
var dialog = {
method: 'permissions.request',
perms: 'publish_stream'
};
FB.ui(dialog,null);
</script>";
}
?>
This code shows permission box properly but problem is that when user grants permission he is redirect to my canvas url (url on servers page) and not on canvas page(i.e. http://apps.facebook.com/xyz). To solve this problem I added redirect_uri to it as
var dialog = {
method: 'permissions.request',
perms: 'publish_stream',
redirect_uri: 'http://apps.facebook.com/xyz'
};
but still it's not working.
Please help me how to solve this problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请尝试以下操作:
您还可以使用 FQL 来检查权限。有关更多信息,请参阅
更新:
Facebook 引入了权限 连接,现在可以使用代替旧的 REST API :
Try this instead:
You can also use FQL to check for the permission. More about that can be found here.
UPDATE:
Facebook introduced the permissions connection and now it can be used instead of the old REST API: