Facebook Canvas 应用程序:API 错误代码:191:身份验证错误
我正在尝试使用 Facebook 的示例设置一个新的 Facebook 应用程序,但身份验证给了我一个错误。
我首先访问 Developers.facebook.com/setup/ 并使用我网站的 URL(尝试了基本文件夹和子文件夹: http://mydomain .com 和 http://mydomain.com/facebook-app/ )
画布 URL :<一href="http://mydomain.com/faceboo-app/" rel="nofollow">http://mydomain.com/faceboo-app/ 安全画布 URL:无
我的 index.php
<?php
$app_id = "XXXXXXXXXXXXXXXXXXXX";
$canvas_page = "http://apps.facebook.com/XXXXXXXXXXXXXXX/";
$auth_url = "http://www.facebook.com/dialog/oauth?client_id="
. $app_id . "&redirect_uri=" . urlencode($canvas_page);
$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("<script> top.location.href='" . $auth_url . "'</script>");
} else {
echo ("Welcome User: " . $data["user_id"]);
}
?>
当我尝试访问 http://apps.facebook.com/XXXXXXXXXXXXXXX/ 时,
我收到:
错误与 APP 名称一起发生。请稍后再试
API 错误代码:191 API错误描述:指定的URL不属于应用程序 错误消息:无效的redirect_uri:应用程序配置不允许给定 URL。
有人可以帮忙吗?
I'm trying to setup a new facebook app using the example from Facebook but Authentication gives me an error.
I first go developers.facebook.com/setup/ and use the URL of my site (tried both the base and subfolder: http://mydomain.com and http://mydomain.com/facebook-app/ )
Canvas URL : http://mydomain.com/faceboo-app/
Secure Canvas URL: none
My index.php
<?php
$app_id = "XXXXXXXXXXXXXXXXXXXX";
$canvas_page = "http://apps.facebook.com/XXXXXXXXXXXXXXX/";
$auth_url = "http://www.facebook.com/dialog/oauth?client_id="
. $app_id . "&redirect_uri=" . urlencode($canvas_page);
$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("<script> top.location.href='" . $auth_url . "'</script>");
} else {
echo ("Welcome User: " . $data["user_id"]);
}
?>
When I try to visit http://apps.facebook.com/XXXXXXXXXXXXXXX/
I get:
An error occurred with APP Name. Please try later
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 permitted by the application configuration.
Can someone please help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须将用户重定向回您的网站,因此您的 $canvas_url 变量必须是您的网址(您在应用程序设置中输入的)
Ou have to redirect user back to your web, so your $canvas_url variable has to be your web URL (which you entered in app setup)