{"id":1746,"date":"2022-08-30T15:19:06","date_gmt":"2022-08-30T15:19:06","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/30\/js-sdk-fb-login-works-but-pop-up-dialog-is-staying-open-after-logged-in-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:19:06","modified_gmt":"2022-08-30T15:19:06","slug":"js-sdk-fb-login-works-but-pop-up-dialog-is-staying-open-after-logged-in-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/js-sdk-fb-login-works-but-pop-up-dialog-is-staying-open-after-logged-in-collection-of-common-programming-errors\/","title":{"rendered":"JS SDK FB.login() works but pop-up dialog is staying open after logged in-Collection of common programming errors"},"content":{"rendered":"<p>I am using the JS SDK for Facebook based on the NEW GraphAPI for Auth\/Login.<\/p>\n<p>Has anyone had this issue when logging in after <code>FB.login()<\/code> was called via the JS SDK?<\/p>\n<p><strong>The problem:<\/strong> after I initialize by calling <code>FB.Init()<\/code> asynchronously (because this all wrapped in a <code>window.fbAsyncInit<\/code> function) the login pops up; I log in but then that pop-up refreshes to show a white page and the pop-up stays open and does not close&#8230;why? I am waiting to check response.session in the <code>FB.login()<\/code> callback but it seems as though I never get it back because this pop-up seems to just stick there and the process appears to just halt after you&#8217;re logged in and I just figured this pop-up would just close and return me the response.session in the callback automatically. Why would that pop-up not go away?<\/p>\n<p>I copied the url from the pop-up after I&#8217;m logged in and showing white the following url so it looks like the response is there but then why isn&#8217;t that pop-up window closing so my callback can handle the response??<\/p>\n<pre><code>http:\/\/static.ak.fbcdn.net\/connect\/xd_proxy.php#?=&amp;cb=f18fe0b7c66da54&amp;origin=http%3A%2F%2Flocalhost%2Ff3745f32ed63a7a&amp;relation=opener&amp;transport=postmessage&amp;frame=f18adb488566372&amp;result=user_photos&amp;session={%22session_key%22%3A%222.vH4SVCisnh8HJWjEI1Vy_Q__.3600.1280106000-100001379631246%22%2C%22uid%22%3A%22100001379631246%22%2C%22expires%22%3A1280106000%2C%22secret%22%3A%22TH45WFg8I_5r_cOoVIujjg__%22%2C%22access_token%22%3A%22132444323462464|2.vH4SVCisnh8HJWjEI1Vy_Q__.3600.1280106000-100001379631246|q123iPQcKY45xWXtOZ2ebOOZTQQ.%22%2C%22sig%22%3A%22a75e85af2354292bfdcf90b9d319ebf7%22}\n<\/code><\/pre>\n<p>I did notice that when FB.login() is called and the login pop-up comes up, I see this error in FireBug talking about how it doesn&#8217;t like the fact that I&#8217;m testing over localhost or something I guess:<\/p>\n<p>uncaught exception: [Exception&#8230; &#8220;Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMLocation.host]&#8221; nsresult: &#8220;0x80004005 (NS_ERROR_FAILURE)&#8221; location: &#8220;JS frame :: chrome:\/\/smarterwiki\/content\/smarterwiki.js :: anonymous :: line 1225&#8221; data: no]<\/p>\n<p>that error bothers me&#8230;I need to figure out why it&#8217;s coming up and I bet you I&#8217;m not the only one who has seen this when testing locally. I see no info though on troubleshooting this on the net anywhere either on the Facebook forums or elsewhere. I see others have had this issue but no resolution.<\/p>\n<p>So when you implemented yours, did your facebook pop-up just close after the user is logged in or did you need to do something special to finish this process?<\/p>\n<p>Also, I notice if I manually close that pop-up then go to check if that cookie was generated to contain my session, it&#8217;s not (the <code>fbs_[yourappid]<\/code> cookie). So it looks like something ends prematurely here. I&#8217;ve got in my init cookie: true so I wonder if this problem were the pop-up dialog is not closing is related to the cookie also not being created client-side on my test PC.<\/p>\n<ol>\n<li>\n<p>This problem appeared out of nowhere for my site, when facebook made a recent change to its &#8220;all.js&#8221;.<\/p>\n<p>In an earlier version of their javascript I had a problem specific to IE, and I copied this little snippet of code from someone&#8217;s post on the internet. It seemed cryptic, but solved the problem at the time:<\/p>\n<pre><code>  \/\/ http:\/\/developers.facebook.com\/bugs\/204792232920393\n\n  \/\/ Hack to fix http:\/\/bugs.developers.facebook.net\/show_bug.cgi?id=20168 for IE7\/8\/9.\n  FB.UIServer.setLoadedNode = function (a, b) { FB.UIServer._loadedNodes[a.id] = b; };\n  FB.UIServer.setActiveNode = function(a, b) { FB.UIServer._active[a.id]=b; };\n<\/code><\/pre>\n<p>It turns out those lines were causing this problem for me. I removed them, and the problem went away. The original bug specific to IE has also been fixed, I believe, in the most recent &#8220;all.js&#8221;.<\/p>\n<\/li>\n<li>\n<p>It seems that you are trying the localhost, can you try it with the public url.<\/p>\n<p>I already faced this problem. But I solved it by configuring the canvas url in application as the public url (example. www.something.com\/test\/).<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-30 19:06:09. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I am using the JS SDK for Facebook based on the NEW GraphAPI for Auth\/Login. Has anyone had this issue when logging in after FB.login() was called via the JS SDK? The problem: after I initialize by calling FB.Init() asynchronously (because this all wrapped in a window.fbAsyncInit function) the login pops up; I log in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1746","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1746","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1746"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1746\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1746"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1746"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1746"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}