Error FB.init (...): "This URL is not allowed by application configuration."

I am trying to complete the tutorial here . But when I call FB.init (...) with what seems to be a valid and correct parameter, I get an error: "This URL is not allowed by the application configuration. One or more of the specified URLs are not allowed application settings. It must match the website URL or the canvas URL, or the domain must be a subdomain of one of the application domains. " I searched ( 1 2 ) for this error, but everyone else seems to have difficulty setting the site URL for their Facebook app setup. I am 99% sure that I installed this correctly, but obviously I'm doing something wrong.

Here is my code that is causing problems. I replaced some of the information β€œXXX” and β€œYYY” for privacy reasons.

<html> <body> <h1>Facebook</h1> <div id="fb-root"></div> <script> // Additional JS functions here window.fbAsyncInit = function() { FB.init({ appId : 'XXX', // App ID channelUrl : '//YYY.com/channel.html', // Channel File status : true, // check login status cookie : true, // enable cookies to allow the server to access the session xfbml : true // parse XFBML }); };//window.fbAsyncInit() // Load the SDK Asynchronously (function(d){ var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; if (d.getElementById(id)) {return;} js = d.createElement('script'); js.id = id; js.async = true; js.src = "http://connect.facebook.net/en_US/all/debug.js"; ref.parentNode.insertBefore(js, ref); }(document)); </script> </body> </html> 

Note that I had to change the js.src parameter at the bottom of the code from the example provided in the tutorial. I doubt that this causes my specific problem, but raises some concern about the quality of the code in the tutorial. (I hate it when the tutorial code doesn't work - what the point?)

You can see in the code above, I replaced the root of my domain name with "YYY". Listed below are some of the values ​​of my Facebook application configuration:

 App ID: "XXX" Display Name: "[blah blah blah]" Namespace: "YYY" App Domains: "YYY.com" Sandbox Mode: "Enabled" Canvas Page: "http://apps.facebook.com/YYY" Canvas URL: "http://YYY.com/canvas/" 

I'm not sure what other details you might need to help me with this. All listed URLs are functional. Thanks for any help!

+7
source share
1 answer

Please note that I had to change the js.src parameter at the bottom of the code from the example in the lesson.

Why? Are you testing, just name your page in the browser from the file system, and not through HTTP through the local web server?

If the latter is the case, then you do not have a β€œdomain” that Facebook could check from your request source. Set up a local web server, call your document through it and try again,

+7
source

All Articles