algorithmicCoder
algorithmicCoder

Reputation: 6789

Why does this code throw a Facebook API Error 191?

I have the following config.php file sitting at www.sitename.com/facebook/

<?php
  require_once 'library/facebook.php';
  $app_id = "xyz";
  $app_secret ="xyz"
  $facebook = new Facebook(array (
    'appId' => $app_id,
    'secret'=> $app_secret,
    'cookie'=> true
  ));
  if(is_null ($facebook->getUser()))
  {
    header("Location:{$facebook->getLoginUrl(array('req_perms'=>'user_status, publish_stream, user_photos'))}");
    exit;
  }
?>

The site URL used in registering the app is http://www.sitename.com/facebook/

so running this file should direct me to an authorization page...instead i get the following error:

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.

Can any one explain how to get around this and why this happens?

Upvotes: 1

Views: 4437

Answers (1)

Love Sharma
Love Sharma

Reputation: 1999

Reason for error 191:

In Facebook Application Setting, Site URL is not same as REQUEST_URI (Redirecting URL) e.g., if you specified site URL to http://www.sitename.com/facebook/ then you are not allow to redirect to http://www.namesite.com/facebook/

Upvotes: 1

Related Questions