Facebook: FB Login Blank Screen

all of a sudden, I get a strange thing happening in my application when trying to login through facebook. The facebook connection pop-up dialog box will display a blank screen after requesting login information. Usually I expected the window to close, and then the site itself will continue to work, however, it looks like it hanged itself.

I am using the Javascript SDK on Localhost

Here is the code I'm using (copying directly from the facebook documentation):

 window.fbAsyncInit = function () { FB.init({ appId: fbAppId, status: false, cookie: true, xfbml: true }); }; (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)); $(document).ready(function () { $("#fb_button_login").click(function () { FB.login(function (response) { if (response.authResponse) { console.log('Welcome! Fetching your information.... '); FB.api('/me', function (response) { console.log('Good to see you, ' + response.name + '.'); }); } else { console.log('User cancelled login or did not fully authorize.'); } }); }); }); 

Some other notes:

  • This happens in all browsers.
  • I studied all other posts and cannot find a solution that works for me.
  • The console does not display error messages
  • During development, I use a separate FB application identifier, which I have installed specifically for localhost with the assigned port that I use (it worked fine for more than 12 months)
    • I don't have a sandbox mode.

The URL it points to is here

Thanks guys.

+6
source share
2 answers

It seems like an error: https://developers.facebook.com/bugs/241915819261223?browse=search_4ff2ead131a032989098325

From the comments in the link above, you can try to run the application on port 80 and avoid the port part in the URL

+1
source

Try using the following code

 <html> <body> <div id="fb-root"></div> <script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js" ></script> <script> FB.init({appId: fbAppId, status: true, cookie: true, xfbml: true}); $(document).ready(function () { $("#fb_button_login").click(function () { FB.login(function (response) { if (response.authResponse) { console.log('Welcome! Fetching your information.... '); FB.api('/me', function (response) { console.log('Good to see you, ' + response.name + '.'); }); } else { console.log('User cancelled login or did not fully authorize.'); } }); }); }); </script> <a href="javascript://" id="fb_button_login">Login</a> </body> </html> 
0
source

Source: https://habr.com/ru/post/919502/


All Articles