FB.getLoginStatus not calling its callback

后端 未结 11 1143
半阙折子戏
半阙折子戏 2021-02-18 13:11

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

相关标签:
11条回答
  • 2021-02-18 13:56

    In Facebook App Settings, go to Client OAuth Settings, look at Valid OAuth redirect URIs

    Make sure you have listed all URIs which are the domains from which Facebook SDK is being invoked. For example:

    I develop at localhost:5000 and deploy to Heroku. Notice the format: http://domain.name/

    0 讨论(0)
  • 2021-02-18 13:57

    I had a similar problem. The site worked every time when I was opening the browser, but fails when I tried to reload.

    The cause was the missing "www" on the site name on Facebook configurations. Note that putting "www" (like www.yoursite.com) works on both situations (yoursite.com or www.yoursite.com).

    0 讨论(0)
  • 2021-02-18 13:58

    According to:

    https://developers.facebook.com/bugs/240058389381072

    You cannot put your application under sandbox mode, or else it won't work. Go into your app settings, advanced, and switch it. This stumped me for a couple hours until I happened upon the bug report.

    0 讨论(0)
  • 2021-02-18 14:06

    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.

    0 讨论(0)
  • 2021-02-18 14:07

    If your application is in sandbox mode, Facebook acts as if your application is invisible to anyone who is not listed as an application developer. If you're not logged in, then it would stand to reason that your app is now invisible.

    The callback will only fire if you're initializing with a visible application. Otherwise the following response is returned:

    <span>Application Error: There was a problem getting data for the application you requested. The application may not be valid, or there may be a temporary glitch. Please try again later. </span>
    

    For more info please see my comment on this bug ticket: https://developers.facebook.com/bugs/240058389381072

    0 讨论(0)
提交回复
热议问题