Facebook API API Error 191

I am trying to integrate my project with Facebook. First, I take baby steps and just try to log in, get a Facebook session and get some user data. I develop it locally, so my Facebook app settings are:

site URL: http://127.0.0.1:8888/mySite/ 

The canvas URL is the same as the previous one. I did not specify a site domain

However, when I click on the login button, I get an error message:

 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. 

At the moment, I have not written server code for working with redirects, etc. All I did was add a JavaScript SDK based on a Facebook tutorial for websites .

How am I wrong? This is clearly related to the settings of my Facebook application, but I don’t see that!

+76
facebook facebook-javascript-sdk
Jan 14 2018-11-11T00:
source share
10 answers

UPDATE:
To respond to API error code: 191
redirect_uri must be equal (or relative) to the site URL.
enter image description here

Tip. Use base URLs instead of full URLs that point to specific pages.

NOT RECOMMENDED: For example, if you use www.mydomain.com/fb/test.html as the URL of your site and << 22> as redirect_uri , this will give you error 191.

RECOMMENDED:. Instead, your site URL will be set to the base URL, for example: www.mydomain.com/ OR www.mydomain.com/fb/ .




Today I looked at the application http: // localhost: 8080 /

Although I was sure that you cannot do this based on your own experience (although a very old test), it seems that you actually CAN test your Facebook application locally!

So, I took the old application and edited its name, site URL and Canvas URL: site URL: http://localhost:80/fblocal/

I downloaded the latest Facebook version of the PHP-SDK and dropped it in the xampp/htdocs/fblocal/ .

But I have the same mistake as you! I noticed that XAMPP is automatically redirecting to http://localhost/fblocal/ , so I changed the setting to just http://localhost/fblocal/ and the error disappeared BUT I had to remove the application (from the privacy settings ) and reinstall my application , and here are the results: <w> alt text

After that I asked publish_stream for permission, and I was able to publish it in my profile (using the PHP-SDK):

 $user = $facebook->getUser(); if ($user) { try { $post = $facebook->api('/me/feed', 'post', array('message'=>'Hello World, from localhost!')); } catch (FacebookApiException $e) { error_log($e); $user = null; } } 

Results: alt text

+87
Jan 14 2018-11-14T00:
source share

For me, it was the missing application domain. Go into the application and make sure that you have the root of your site configured as the application domain. See screenshot.

app domains is in the basic settings of your app

+11
May 23 '13 at 16:47
source share

This is only due to a URL error.

No matter what website URL is listed, it should be correct.

I mentioned the site URL as http://localhost:3000/ and the domain as localhost, but in my browser I ran http://localhost:3000/ http://0.0.0.0:3000/ .

When I started the server as localhost:3000 , it solved the problem.

As I mentioned, the site URL as localhost Facebook will be redirected to the same, if we work 0.0.0.0:3000 , this will lead to the error: "The specified URL is not allowed by the application configuration."

+8
Apr 30 '12 at 8:20
source share

I also encountered the same problem when using facebook authentication method. But I am fixing this problem with the following changes to the Facebook api ( Apps >> My App >> Basic ).

  • I deleted the URL that I gave in ===> Facebook App (canvas URL)
  • I gave the site URL only in ===> Website with Facebook login feature

Then I gave this AppId and App Secret on my web page.

So, by clicking on the login button, he asks for permission to access, then redirects it to specify the URL ( Website with Facebook login).

+2
Sep 10
source share

There was the same problem:

 $params = array('redirect_uri' => 'facebook.com/pages/foobar-dev'); $facebook->getLoginUrl($params); 

When I changed redirect_uri from the devloper page to the current page, error 191 occurred.

So, I removed $ params:

 $facebook->getLoginUrl(); 

After the requesting application now redirects the FB to the application’s own url fe: my.domain.com

Now I check my application's index.php if I am inside an FB iframe or not. If not, I am redirected to the current FB fe page:

 $app = 'facebook.com/pages/foobar-live'; $rd = (isset($_SERVER['HTTP_REFERER'])) ? parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST) : false; if ($rd == 'apps.facebook.com' || (!isset($_REQUEST['signed_request']))) { echo '<script>window.parent.location = "'.$app.'";</script>'; die(); } 
0
Nov 21 '12 at 17:22
source share

I also noticed that even if you specify your site in the secion section - Website With Facebook Login → Site URL, for example. http://example.com , but if your Application Domains section is empty and you open the site as www.example.com, you will also get this error. To avoid this, in the "Application Domains" section, write example.com, which will allow subdomains, for example, www.example.com, something.example.com, etc.

0
Dec 05
source share

on the facebook application page, go to the main tab. Find the option "Website with Facebook".

you will find the site URL: enter the full URL here (e.g. http://Mywebsite.com/MyLogin.aspx ). this is a url that you can use with a call, for example, if the APP id is 123456789

https://graph.facebook.com/oauth/authorize?client_id=123456789&redirect_uri=http://Mywebsite/MyLogin.aspx&scope=publish_actions

0
Jun 28 '13 at 19:47
source share

Something I would like to add since this is the first google error 191 question:

When redirecting to facebook instead of your own site for a signed request, you may encounter this error if the user has a safe view and your application redirects to facebook without SSL.

0
Dec 05 '13 at 16:15
source share

Work locally ... I could not get api feeds to work, but share api worked almost immediately without any problems.

0
Sep 08 '15 at 9:44
source share

I fixed this by passing the FacebookRedirectLoginHelper::getAccessToken() redirect URL in my callback function:

Transfer from

 try { $accessToken = $helper->getAccessToken(); } ... 

at

 try { $accessToken = $helper->getAccessToken($fbRedirectUrl); } ... 

I am developing on a stray field and it looks like FacebookRedirectLoginHelper::getCurrentUrl() having trouble creating a valid URL- FacebookRedirectLoginHelper::getCurrentUrl() .

0
Jun 11 '18 at 9:40
source share



All Articles