Facebook API错误代码:191

时间:2014-01-21 06:13:03

标签: facebook facebook-php-sdk facebook-canvas

我真的很感激一些帮助。我四处寻找,我觉得我已经尝试了一切,但无济于事。

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.

这些是我的设置:

App Domains: localhost
Canvas URL: http://localhost/friendsmash/
Secure Canvas URL: *empty*
App Available to Public: No
Valid OAuth redirect URIs: http://localhost/friendsmash/

编辑:

当我尝试转到画布URL时出现错误。换句话说,我说:

http://localhost/friendsmash/

在我的浏览器中。它将我重定向到这里:https://www.facebook.com/dialog/oauth?client_id=592670390826338&redirect_uri=https%3A%2F%2Fapps.facebook.com%2Ftestappertest%2F&state=8712a908d02c6b6fc3fa9c19c9747296&scope=email%2Cpublish_actions

然后,我看到了错误。当我转到画布页面时,我得到一个空白页面。至于代码,我正在学习本教程:https://developers.facebook.com/docs/games/canvas/canvas-tutorial

我审查了应用程序ID和秘密。无论如何,这是代码的相关部分:

<?php
require 'server/fb-php-sdk/facebook.php';

$app_id = 'XXXXXX';
$app_secret = 'XXXXXX';
$app_namespace = 'testappertest';
$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>');
}
?>

0 个答案:

没有答案