어제까지 작동했던 코드가 갑자기 오류가 발생하기 시작했습니다. 어떤 변화가 있었는지 전혀 모른다. 그것은 또한 Facebook Serve side authentication에서 코드를 기반으로합니다 또한 비슷한 제목으로 다른 게시물을 참조하지만 그들은 많은 행운과 함께 언급 시도.Facebook 오류 : 앱에 오류가 발생했습니다. 잠시 후 다시 시도하십시오.
다음은 HTTP와 HTTPS와 //은 또한 응용 프로그램에 직접 경로로 시도 my_url 에서 https로 시도 코드
<?php
$app_id = "my app id";
$app_secret = "my app secret";
$my_url = "http://apps.facebook.com/myappnamespace";
//이고 잘 작동하지 않습니다. session_start(); $ code = $ _REQUEST [ "code"];
if(empty($code)) {
$_SESSION['state'] = md5(uniqid(rand(), TRUE)); //CSRF protection
$dialog_url = "https://www.facebook.com/dialog/oauth?client_id="
. $app_id . "&redirect_uri=" . urlencode($my_url) . "&state="
. $_SESSION['state'];
echo("<script> top.location.href='" . $dialog_url . "'</script>");
}
if($_REQUEST['state'] == $_SESSION['state']) {
$token_url = "https://graph.facebook.com/oauth/access_token?"
. "client_id=" . $app_id . "&redirect_uri=" . urlencode($my_url)
. "&client_secret=" . $app_secret . "&code=" . $code;
$response = file_get_contents($token_url);
$params = null;
parse_str($response, $params);
$graph_url = "https://graph.facebook.com/me?access_token="
. $params['access_token'];
$user = json_decode(file_get_contents($graph_url));
echo("Hello " . $user->name);
}
else {
echo("The state does not match. You may be a victim of CSRF.");
}
?>
캔버스에로드하는 대신 Facebook 캔버스 외부로 보냅니다. – pal4life