简体   繁体   English

访问令牌?

[英]Access tokens?

I am developing an app in PHP hosted on Heroku, and my biggest problem is not getting access tokens for a user to get my app to fully work. 我正在用Heroku托管的PHP开发一个应用程序,最大的问题是没有为用户获取访问令牌以使我的应用程序正常运行。 The app works perfectly for me (as I am an admin), but other people who arent associated with the app cannot get the app to display anything. 该应用程序非常适合我(我是管理员),但是与该应用程序相关联的其他人无法让该应用程序显示任何内容。 I also tried using test users to see if it would work, but still no luck. 我还尝试使用测试用户来查看它是否可以运行,但还是没有运气。 Im pretty sure it has to do with access tokens and the app not having permission to do its thing. 我非常确定它与访问令牌有关,并且该应用没有权限执行其操作。 How and where do I fix this? 如何以及在哪里修复此问题?

for user access_token i use, where the number is the application id. 我使用的用户access_token ,其中数字是应用程序ID。


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

for application access token i use cURL. 对于应用程序访问令牌,我使用cURL。 the return results are like access_token=xxxxxxxxxx use like - /anotherfeed/feed?$app_access_token 返回结果就像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