我编写了以下代码来验证 facebook 应用程序,但是很多天它都没有解决,而不是 google。问题是首次访问应用程序时,用户会提示应用程序身份验证对话框。当用户允许应用程序时,它会不断闪烁 url。既不显示对话框也不显示应用程序。关闭浏览器后是的,它运行良好。请你找出问题所在。我将非常感激。
代码:
$canvas_page = "---my canvas url----"; //i removed actual url here!
// Create our Application instance (replace this with your appId and secret).
$auth_url = "http://www.facebook.com/dialog/oauth?client_id="
. $app_id . "&redirect_uri=" . urlencode($canvas_page) ."&scope=email,read_stream";
$signed_request = $_REQUEST["signed_request"];
list($encoded_sig, $payload) = explode('.', $signed_request, 2);
$data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);
if (!empty($data["user_id"])) {
echo 'Hello: '.$data["user_id"];
}else{
echo "What is the hell";
echo("<script> location.href='" . $auth_url . "'</script>");
}