我尝试了几种方法,例如:在这里没有运气。我正在使用他们的facebook php sdk。
现在发生的事情是,应用程序在通过身份验证后被重定向到我的站点。
<?php
require_once 'php-sdk/facebook.php';
$app_id = "***";
$app_secret = "***";
$facebook = new Facebook(array(
'appId'=> $app_id,
'secret' => $app_secret,
'cookie' => true
));
$user = $facebook->getUser();
if(!$user)
{
$auth_url = $facebook->getLoginUrl(array('scope' => 'email'));
echo("<script> top.location.href='" . $auth_url . "'</script>");
}
?>
我尝试将auth_url替换为:
$auth_url = $facebook->getLoginUrl(array('scope' => 'email',
'redirect_uri' => 'http://apps.facebook.com/ridetogether'));
但是提示告诉我redirect_url不属于我:
"一起骑"出错。请稍后再试。
API Error Code: 191
API Error Description: The specified URL is not owned by the application
Error Message: Invalid redirect_uri: Given URL is not allowed by the Application configuration.
我还能做些什么来重定向回facebook内的canvas应用程序?
API错误码:191API错误描述:指定的URL不属于应用程序错误消息:Invalid redirect_uri:给定的URL不被应用程序配置允许。
您的名称空间/画布页面在您的应用程序设置正确吗?你可能需要再检查一次
您需要在您的域中指定一个要重定向到的特定页面,如
$params = array(
'scope' => 'email',
'redirect_uri' => $authPageURL,
);
$auth_url = $facebook->getLoginUrl($params);
然后该页面需要使用301重定向到您的画布URL。创建一个auth。php之类的页面里面有这个
if(isset($_REQUEST['error_reason']))
{
header('Location: '.$auth_error_page);
}
else
{
header('Location: '.$FB_canvas_page);
}
然后使用该页作为重定向URI