开发者

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


If you pass the non existing FB app key to init() then only you get the error of 'FB.login() called before calling FB.init()'

Make sure, you hadn't been doing the same.


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


Seeing as no one on the interwebs was able to answer my question, I wiped out the old Facebook app entirely (on my developers.facebook.com account) and just made a new app from scratch and made a totally new one.

After that, the basic code did the job


I have same problem in my case was APP-ID, When you try to post at fb withoud App-ID you'll get same.


This worked for me

<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">
  FB.init({
    appId  : true,
    status : false, // check login status
    cookie : false, // enable cookies to allow the server to access the session
    xfbml  : true  // parse XFBML
  });
</script>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜