Note that there are some explanatory texts on larger screens.

plurals
  1. POFB.ui puzzle: inconsistent error code 191... (seems like FB.init is frequently not working)
    primarykey
    data
    text
    <p>I'm using FB.ui() like so:</p> <pre><code>&lt;script&gt; window.fbAsyncInit = function() { FB.init({ appId : '##########', // App ID channelUrl : '//www.xxxxxxxxxx.com/channel.php', // Channel File status : true, // check login status cookie : true, // enable cookies to allow the server to access the session xfbml : true // parse XFBML }); // Additional initialization code here }; // 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 = "//connect.facebook.net/en_US/all.js"; ref.parentNode.insertBefore(js, ref); }(document)); &lt;/script&gt; </code></pre> <p>Then, here's the link to send the message:</p> <pre><code>&lt;a href='#' onClick=" FB.ui({ method: 'send', name: 'Bla bla bla', link: 'http://www.xxxxxxxxxxx.com', to: ###########, //redirect_uri: 'http://www.xxxxxxxxxxx.com/fb/' }); "&gt;Send a message&lt;/a&gt; </code></pre> <p><strong>PROBLEM:</strong> This works like a charm for me and every computer/browser I've tested on. But my client gets the following error message very frequently:</p> <pre><code>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 </code></pre> <p><img src="https://i.stack.imgur.com/Uphdq.png" alt="enter image description here"></p> <p>This has me totally stumped! Is anything wrong with my code? And if so, why can't I EVER reproduce this bug while my client consistently can on multiple computers/browsers?</p> <p>PS: If you want to try yourself, the page is live <a href="http://www.streetofwalls.com/fb/" rel="nofollow noreferrer">here</a>. You'll have to authorize the app, but I promise nothing creepy will happen.</p> <p><strong>EDIT:</strong> The error mentions the <code>redirect_uri</code>, which you'll notice is commented out in my code. The reason is because when I include that parameter, the dialogue doesn't close when I hit "close".</p> <p><strong>EDIT2:</strong> I was able to reproduce this bug on a friend's computer, and CBroe also confirmed it. So, (setting aside the mystery of why I still can't produce it myself), the thing that has me most stumped is why does this only happen half of the time?? If my code is incorrect it should never work, right??</p> <p>Here's the url from the error message:</p> <pre><code>https://www.facebook.com/dialog/send?display=popup&amp;link=http%3A%2F%2Fwww.streetofwalls.com&amp;locale=en_US&amp;name=Career%20Networking%20powered%20by%20Street%20of%20Walls&amp;next=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D8%23cb%3Df2c657ef78%26origin%3Dhttp%253A%252F%252Fwww.streetofwalls.com%252Ff3575a615c%26domain%3Dwww.streetofwalls.com%26relation%3Dopener%26frame%3Df1ca46b43c%26result%3D%2522xxRESULTTOKENxx%2522&amp;sdk=joey&amp;show_error=true&amp;to=573501273 </code></pre> <p>After <code>url_decode()</code> version:</p> <p><code>https://www.facebook.com/dialog/send?display=popup&amp;link=http://www.streetofwalls.com&amp;locale=en_US&amp;name=Career Networking powered by Street of Walls&amp;next=http://static.ak.facebook.com/connect/xd_arbiter.php?version=8#cb=f2c657ef78&amp;origin=http%3A%2F%2Fwww.streetofwalls.com%2Ff3575a615c&amp;domain=www.streetofwalls.com&amp;relation=opener&amp;frame=f1ca46b43c&amp;result=%22xxRESULTTOKENxx%22&amp;sdk=joey&amp;show_error=true&amp;to=573501273</code></p> <p><strong>EDIT3:</strong> Part of this puzzle is solved. The times when the error occurs are the result of <code>FB.init()</code> not working. I've wrapped the <code>FB.ui()</code> in <code>FB.getLoginStatus(function(response){ \\... }</code> so now you can see a more useful error in the console. The open question is... WHY DOES FB.init() fail so often?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload