Search code examples
facebookfbjs

FB.getLoginStatus not calling its callback


The title really says it all. Under some (undetermined) conditions FB.getLoginStatus() just stops working and won't invoke the callback I gave it. The only interesting clues I've found are

  • FB.Auth._loadState is stuck on "loading" -- whatever is supposed to make it click over to "loaded" isn't happening
  • slight delays like putting in alert() calls tend to make it start working

Any hints at all about even how to investigate this welcome.


Solution

  • This usually happens for me when I am running the page under a different domain from what has been registered in Facebook. Typically this is when I am developing locally.

    If you are running locally, you'll have to set up a local web server and then modify your hosts file to point the the registered domain to 127.0.0.1 in order to test on your local machine. Don forget to remove that line from the hosts file when you want to test it on the server.