简体   繁体   中英

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. 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.


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

for application access token i use cURL. the return results are like access_token=xxxxxxxxxx use like - /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;
};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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