Search code examples
javascriptauthenticationfacebook

Error: FB.login() called before calling FB.init()


I use this Facebook Login Button code:

<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
  FB.init({
    appId  : 'myActualId',
    status : true, // check login status
    cookie : true, // enable cookies to allow the server to access the session
    xfbml  : true  // parse XFBML
  });
</script>
<fb:login-button show-faces="false" width="200" max-rows="1"></fb:login-button>

But the debug console gives me this error: FB.login() called before calling FB.init().

I made a test page so my error can be seen: http://www.comehike.com/test_fb_connect.php

I have no idea what I am doing wrong. Any help would be much appreciated!

Thanks, Alex


Solution

  • You're loading the Facebook script all.js twice. It should be loaded only once.