Facebook API范围 [英] Facebook API scope

查看:170
本文介绍了Facebook API范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用base_facebook.phpfacebook.php我忘记定义范围并运行它:

Using the base_facebook.php and facebook.php I forgot to define a scope and ran this:

$app_id = "11111111111";
$app_secret = "aaaaaaaaaaaaaaaa";
$facebook = new Facebook(array(
                        'appId' => $app_id,
                        'secret' => $app_secret,
                        'cookie' => true
                        ));
if(!($facebook->getUser()))
{
        header("Location:{$facebook->getLoginUrl(array('req_perms' => 'user_status,publish_stream,user_photos'))}");
        exit;
}

编辑,我将标题行更改为以下内容,但是没有运气:

Edit I changed the header line to the following one with no luck:

header('Location:'.$facebook->getLoginUrl(array('req_perms' => $scope)));

我第一次访问该页面时,我被重定向到一个要求我接受此应用程序的地方.我做到了,其余的都正常工作.

First time I visited the page I got redirected to a place that asked me to accept this app. I did and the rest worked correctly.

现在我意识到我需要定义一个范围,所以我添加了一个逗号分隔的字符串,例如user_checkins,但是刷新页面并不需要额外的协议,也不允许我查看我的签到内容. /p>

Now I realize that I needed to define a scope, so I added a comma separated string, such as user_checkins but refreshing the page doesn't ask for extra agreement, nor does it allow me to view my checkins.

$scope = 'user_checkins,user_likes';

$facebook = new Facebook(array(
                        'appId' => $app_id,
                        'secret' => $app_secret,
                        'cookie' => true,
                        'scope' => $scope
                        ));

我错过了一些琐碎的事情吗?我尝试重置应用程序的机密,但是什么也没做.我也找不到合适的教程:(

Am I missing something trivial? I tried resetting the app secret, but that did nothing. Also I can't find a decent tutorial :(

提前谢谢!

答案:在new Facebook()中添加scope不会执行任何操作!错误是使用getLoginUrl()传递了req_perms并且需要传递scope:

Answer: Adding scope in new Facebook() doesn't do anything! Error was that using getLoginUrl() passed req_perms and needed to pass scope :

 header('Location:'.$facebook->getLoginUrl(array('scope' => $scope)));

推荐答案

您缺少的东西很简单,只需在Facebook中转到您的帐户,然后在您的隐私设置中转到应用程序和网站",然后删除当前设置即可对于您想要的应用程序,现在再试一次,它将不得不提示您输入新闻扩展权限中的权限,祝您好运,让我知道它是否有效:)

What you are missing is something easy, just go to your account in facebook and in your privacy settings go to your "apps and websites" and delete the current settings for your desire app, now try again it will have to prompt you for your permissions in the news extended perms, good luck, let me know if it works :)

这篇关于Facebook API范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆