閱讀所有TUTS和問題後計算器我仍然沒有得到它的工作 代碼:Facebook的格式不正確的訪問令牌
<?php
include_once 'debug/debug.php';
if (isset($_GET["username"])) {
$appId="XXX";
$appSecret="YYY";
$code = $_GET["code"];
echo "Code: <br>" . $code . "<hr>";
//Optain App Token!
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL,
"https://graph.facebook.com/oauth/access_token?client_id=" . $appId .
"&client_secret=". $appSecret.
"&grant_type=client_credentials");
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);
$access_token = explode("=", $result)[1];
echo $access_token;
//Option further Information
$ch = curl_init();
//curl_setopt ($ch, CURLOPT_URL, "https://graph.facebook.com/me?access_token=" . $code);
curl_setopt ($ch, CURLOPT_URL, "https://graph.facebook.com/debug_token?input_token=" . $code . "&access_token=" . $access_token);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
}
?>
答案是:
{「數據」:{「錯誤」:{「消息「:」 格式錯誤的接入令牌AQB6hhoeZJ1SR5RqtPp-iEDEd1Fg38GV95tW2YrVR9EfK6Y8H7QgcrSr8uagegIpKa4rPI7z4qSw45COZZL1XMDUuigsrBLNg5NKXl2bd9GPYC1Qo5peH81mGqP6LqK-orL3uqCH3Bta3kHOGp76RmK8p391soS47ZR8WE5gNx6s35qctgoHuWE47R0w93GeNglRxu2IUtVsGhZgyGiA9l12BMq9NX5O9Kcp2DupVqWs67Vnqz8MntrTx-AzbFhdHrYtWOhmFb8WybrT3ZuGqETZEAGc9JOTuhiHJW3Elp_rE7IWA50MIWsAaqM77fuI1Go」, 「代碼」:190}, 「is_valid」:假}}
https://www.facebook.com/dialog/oauth?client_id=APP_ID&redirect_uri=http://www.mineforce.de/ms/fblogin.php?username=USERNAME
我不明白爲什麼訪問令牌應該是錯的,因爲我們被Facebook自身獲得它:$代碼是由登錄從Facebook調用這個URI給出。
的outprints等都可以在這裏找到:
http://www.mineforce.de/ms/fblogin.php?username=phibedy&code=AQB6hhoeZJ1SR5RqtPp-iEDEd1Fg38GV95tW2YrVR9EfK6Y8H7QgcrSr8uagegIpKa4rPI7z4qSw45COZZL1XMDUuigsrBLNg5NKXl2bd9GPYC1Qo5peH81mGqP6LqK-orL3uqCH3Bta3kHOGp76RmK8p391soS47ZR8WE5gNx6s35qctgoHuWE47R0w93GeNglRxu2IUtVsGhZgyGiA9l12BMq9NX5O9Kcp2DupVqWs67Vnqz8MntrTx-AzbFhdHrYtWOhmFb8WybrT3ZuGqETZEAGc9JOTuhiHJW3Elp_rE7IWA50MIWsAaqM77fuI1Go#=
其次我不明白爲什麼把FB#=在令牌
乾杯:)