Getting this error after months of no problems - redirect_uri not owned by application

StackOverflow https://stackoverflow.com/questions/16115265

  •  11-04-2022
  •  | 
  •  

Question

I had this problem initially when I started the Facebook integration of our site. After doing some searching, found the solution and fixed it.

Now, a few months later, it has just stopped working. Nothing was changed in either the javascript code or the app settings on the Facebook developers site. I once again set about searching, and found the same answers as before: Site URL must match redirect_uri etc.

I currently have the App Domain: "domain.com"
And the Site URL: "http://www.domain.com"

Error given:

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.

I'm at a loss as to what has happened. Has Facebook changed their API? (I did check their documentation, and it's still the same).

Any help would be greatly appreciated. Javascript code below:

var publish = {
    method: 'feed',
    redirect_uri: 'http://www.domain.com',
    link: 'http://www.domain.com',
    picture: 'http://pathtoimage/logo.png',
    name: 'Name',
    caption: 'Title',
    description: 'Description, blah blah'
};

function fbcallback(response) {
    // do stuff here
}

FB.ui(publish, fbcallback);

Thanks

EDIT:
I checked the timestamp and the JS file hasn't been touched since the 16th of March, neither has the App Settings on Facebook, and my colleague tested this just a week ago (was still working then)

Was it helpful?

Solution

RESOLVED:

For others that are having the same problem, here's what worked for me.

It appears that FB have tightened their security, which is why it was originally working.
We were working on a new release, and were using the IP address instead of the domain to access the site. A new message I hadn't seen previously started appearing in the dev console:

When using FB.ui, you should not specify a redirect_uri.

Looks like the FB api now checks the URL domain in the address field of the browser (rather than the redirect_uri) against the Site URL in the Facebook App Settings. Tested this by temporarily pointing our domain to the IP address, and running the Facebook api code via the domain loaded site, and it worked. So while we're testing before the release, I'll use http://localhost:8080 as the Site URL, then update it to the site's domain when it goes live.

Thanks to the people who helped to point me in the right direction!

OTHER TIPS

Try to check if in your app settings (on Facebook Developers) you have set:

  • 'App domain' with the domain where you're using the app
  • Check the 'Website with Facebook Login' option and then set the domain there
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top