Possible Duplicate:
Facebook API error 191
I am getting the following error with some code that I am using. The error is
API Error Code: 191
API Error Description: The specified URL is not owned by the application
Error Message: redirect_uri is not owned by the application.
<?php
$facebook = new Facebook(array('appId' => $app_id,'secret' => $app_secret,'cookie' => true));
if($facebook->getUser() < 1)
{
$red_url = $page_url.'?sk=app_'.$app_id;
$redir = $facebook->getLoginUrl(array('redirect_uri'=>$red_url,'next'=>$red_url,'scope'=>'offline_access,publish_stream,status_update,photo_upload,user_birthday'));
echo "<script>top.location.href='".$redir."';</script>";
exit;
}
$user = $facebook->api('/me');
Can any one explain how to get around this and why this happens?
When you open a Facebook application you need to set the domain/s under which your application is intended to run – and (almost) every place that your app gets in contact with facebook (especially client side) must be from a url from the same domain (or a subdomain of it)
in your case you told asked facebook to authorize the app for the user and then redirect him to
$red_urlwhich I understand to be the page where your app is installed – BUT this link is not under the domain of your application (unless you registeredfacebook.comas your app domain in the application dashboardif you want to redirect the user to that specific tab – you may create a proxy file under the domain of your application that will redirect the user to the tab, for example:
lets say you registered
mydomain.comas your app domain in the app dashboard . then – create a file namedredirect.phpfor example that will conatin the following script and put it underhttp://www.mydomain.com/my_directory/redirect.php:and your script will change to be: