2014-12-02 71 views
-1

我使用图形API浏览器获取了我的facebook应用的访问令牌,并且还从服务器端获得了长期访问令牌。但我无法编辑我获得的长期存取令牌的权限和范围。 我已经上传访问令牌调试器的屏幕截图,以获取从图形API浏览器获得的访问令牌以及从服务器端获得的长期访问令牌。请帮助您了解如何编辑服务器端长期访问令牌的范围。授予权限和范围的长期访问令牌

enter image description here

如在示波器的屏幕​​截图看到,它有那么多的权限。但是我从服务器端获得的访问令牌只有一个范围“public_profile”。我应该如何授予从服务器端获得的长期访问令牌的权限?请帮助

我的登录密码

<?php 



$a=$_GET["query"]; 




    $app_id = "xxxxxx"; 
    $app_secret = "xxxxxxxxxx"; 
    $redirect_uri = "http://localhost/url_encode.php/"."?"."f=".$a; 
// echo $my_url; 


$dialog_url = "http://www.facebook.com/dialog/oauth?client_id=" 
     . $app_id . "&redirect_uri=" .$redirect_uri; 

    echo("<script> top.location.href='" . $dialog_url 
     . "'</script>"); 


My code for generating the long lived access token. 

     <?php 
//include ('search_query.php'); 

$b=$_GET['code']; 
$c=$_GET['f']; 
//echo $b; 
//echo "<br>"; 
//echo "<br>"; 
//echo $c; 
//$a=$_GET['f']; 


$redirect_uri="http://localhost/url_encode.php/"."?"."f=".$c; 


if(empty($b)){ 

    $dialog_url = "http://www.facebook.com/dialog/oauth?client_id=" 
     . $app_id . "&redirect_uri=" .$redirect_uri; 

    echo("<script> top.location.href='" . $dialog_url 
     . "'</script>"); 





} 


$token_url="https://graph.facebook.com/oauth/access_token?client_id=xxxxxx&redirect_uri=".$redirect_uri."&client_secret=xxxxxxxxx&code=".$b; 
$access_token=file_get_contents($token_url); 

//echo $access_token; 
$position_of_string=strpos($access_token ,"&"); 
$actual_access_token=substr($access_token,0,$position_of_string); 
echo $actual_access_token; 

$url="https://graph.facebook.com/".urlencode($c); 
$json_object=file_get_contents($url); 

>

+0

对不起,但这不够详细,给你任何认真的答案。例如,你的登录代码如何? – luschn 2014-12-02 08:29:32

+0

我粘贴了我的代码以进行登录和访问令牌生成 – 2014-12-02 08:49:55

回答