繁体   English   中英

访问令牌?

[英]Access tokens?

我正在用Heroku托管的PHP开发一个应用程序,最大的问题是没有为用户获取访问令牌以使我的应用程序正常运行。 该应用程序非常适合我(我是管理员),但是与该应用程序相关联的其他人无法让该应用程序显示任何内容。 我还尝试使用测试用户来查看它是否可以运行,但还是没有运气。 我非常确定它与访问令牌有关,并且该应用没有权限执行其操作。 如何以及在哪里修复此问题?

我使用的用户access_token ,其中数字是应用程序ID。


if($_SESSION['fb_135669679827333_access_token']){
$access_token = $_SESSION['fb_135669679827333_access_token'];
}

对于应用程序访问令牌,我使用cURL。 返回结果就像access_token = xxxxxxxxxx一样-/ anotherfeed / feed?$ app_access_token


$app_access_token = GetCH();
function GetCH(){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://graph.facebook.com/oauth/access_token?client_id=APP_ID&client_secret=SECRET_KEY&grant_type=client_credentials");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
if(substr($url,0,8)=='https://'){
    // The following ensures SSL always works. A little detail:
    // SSL does two things at once:
    //  1. it encrypts communication
    //  2. it ensures the target party is who it claims to be.
    // In short, if the following code is allowed, CURL won't check if the 
    // certificate is known and valid, however, it still encrypts communication.
    curl_setopt($ch,CURLOPT_HTTPAUTH,CURLAUTH_ANY);
    curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
}
$sendCH = curl_exec($ch);
curl_close($ch);
return $sendCH;
};

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM