{"id":5646,"date":"2014-04-04T15:17:08","date_gmt":"2014-04-04T15:17:08","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/04\/fb-getloginstatus-does-not-fires-callback-function-collection-of-common-programming-errors\/"},"modified":"2014-04-04T15:17:08","modified_gmt":"2014-04-04T15:17:08","slug":"fb-getloginstatus-does-not-fires-callback-function-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/04\/fb-getloginstatus-does-not-fires-callback-function-collection-of-common-programming-errors\/","title":{"rendered":"FB.getLoginStatus does not fires callback function-Collection of common programming errors"},"content":{"rendered":"<p>I have a difficult problem. Difficult means I searched through the net and StackOverflow as well the whole FBJS SDK documentation and haven&#8217;t find answer.<\/p>\n<p>I am building a Page Tab application where I&#8217;d like to let fans to rsvp events. So I have to check if the user is logged in and if it doesn&#8217;t I have to login. That sounds pretty easy, but FB.getLoginStatus doesn&#8217;t fires callback function. This is the code excerpt:<\/p>\n<pre><code>FB.init({\n   appId: window.appID,\n   status: true,\n   xfbml: true,\n   cookie: true,\n   oauth: true,\n   channelUrl: 'http:\/\/example.com\/fb\/channel.html'\n }); \n<\/code><\/pre>\n<p>and then I simply &#8211; of course after the user clicks on a button &#8211; call FB.getLoginStatus, but it seems it doesn&#8217;t do anything.<\/p>\n<p>I&#8217;ve already checked sandbox mode, FB.init success, URLs in application settings and developing environment. I can call FB.ui, although FB.ui with method: &#8216;oauth&#8217; I get an error message saying &#8221; The &#8220;redirect_uri&#8221; parameter cannot be used in conjunction with the &#8220;next&#8221; parameter, which is deprecated.&#8221;. Which is very weird because I didn&#8217;t used &#8220;next&#8221; parameter. But when I set next to undefined, it works fine, I get the window, but it says &#8220;Given URL is not allowed by the Application configuration.&#8221;. Expect from that, I can login, then I&#8217;ve got the access_token. But in the new window, getLoginStatus still doesn&#8217;t do anything.<\/p>\n<p>So any advices are welcome.<\/p>\n<p>Thanks, Tamas<\/p>\n<p><strong>UPDATE<\/strong>:<\/p>\n<pre><code>function onBodyLoad() { \/\/on body onload\n    FB.init({\n     appId: window.appID,\n     status: true,\n     xfbml: true,\n     cookie: true,\n     oauth: true,\n     channelUrl: 'http:\/\/example.com\/fb\/channel.html'\n    });     \n   }\n...\nfunction getName() { \/\/ on button onclick\n FB.getLoginStatus(function(response){\n  if (response.authResponse)\n   {\n    window.loggedIn = true;\n    debugString('Logged in');\n   } else\n   {\n    window.loggedIn=false; \n    debugString('Not logged in');\n   }\n}, true);\nif (window.loggedIn === undefined)   {\n     debugString('getLoginStatus did not exec'); \/\/ I always get this message\n  }\n<\/code><\/pre>\n<p>}<\/p>\n<p><strong>UPDATE 2<\/strong>: I created a new App on a different URL, which is configured as a standalone website. There these codes work perfectly, I can getLoginStatus, I can login, etc. Is there any difference working in the context of FB, and in a standalone website, using FB JavaScript SDK?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have a difficult problem. Difficult means I searched through the net and StackOverflow as well the whole FBJS SDK documentation and haven&#8217;t find answer. I am building a Page Tab application where I&#8217;d like to let fans to rsvp events. So I have to check if the user is logged in and if it [&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-5646","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5646","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=5646"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5646\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5646"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5646"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}