我一直在寻找解决我的问题的地方,但目前为止无济于事。Facebook应用程序登录错误
我正在按照步骤创建一个Facebook Tutorial的Facebook应用程序,并且在登录过程中遇到了问题,尽管我似乎正在做所有事情都是正确的。当应用程序尝试登录时,我收到以下错误:
Given URL is not permitted by the application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.
你会认为有什么毛病我的应用程序的配置,但是这似乎并不如此。下面是截图:
画布URL是正确的,我已经有或没有填写的应用程序域实地测试。这里是登录的PHP:
<?php
require 'server/fb-php-sdk/facebook.php';
$app_id = '236534686497558';
$app_secret = '***************************';
$app_namespace = 'mytestsmash';
$app_url = 'https://apps.facebook.com/' . $app_namespace . '/';
$scope = 'email,publish_actions';
// Init the Facebook SDK
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
));
// Get the current user
$user = $facebook->getUser();
// If the user has not installed the app, redirect them to the Login Dialog
if (!$user) {
$loginUrl = $facebook->getLoginUrl(array(
'scope' => $scope,
'redirect_uri' => $app_url,
));
print('<script> top.location.href=\'' . $loginUrl . '\'</script>');
}
?>
我不明白这里发生了什么问题。
我相信它在getLoginUrl中的错误redirect_uri - 它应该匹配应用程序设置中的应用程序域或画布网址。重定向URI是用户在用他/她的FB凭证成功登录后将被重定向到的地址。 – xjedam
重定向应该位于Facebook画布内的Canvas页面(意味着应用程序在Facebook内运行)。这与我从中复制代码的教程相同。但我按照你的建议做了,将app_url改为canvas URL,然后退出facebook画布,并在登录之后继续加载登录,直到发出错误:警告:由于安全原因,curl_exec()已被禁用。所以我不认为这是一个解决方案。 – dlofrodloh
啊解决了! $ app_url是httpS ...但画布页的网址只是http! – dlofrodloh