开发者

Can I require FBConnect with the new Graph API?

开发者 https://www.devze.com 2023-01-26 07:28 出处:网络
I\'m using the new JS SDK API.(Graph API) However, if I include the FeatureLoader.js for old FBCOnnect, then it will overwrite the graph API functions..

I'm using the new JS SDK API. (Graph API)

However, if I include the FeatureLoader.js for old FBCOnnect, then it will overwrite the graph API functions..

so, is there anyway in new JS SDK that I can do 开发者_开发技巧requireFeatures(['Connect'] ...) as in

FB.Bootstrap.requireFeatures(["Connect"], function()
{

}


No. None of that stuff is needed or supported in the new SDK. All you need to do is initialize the Javascript SDK and call the login method to login.

An example of how to do login:

<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
  FB.init({appId: 'your app id', status: true, cookie: true, xfbml: true});
  FB.Event.subscribe('auth.sessionChange', function(response) {
    if (response.session) {
      // A user has logged in, and a new cookie has been saved
    } else {
      // The user has logged out, and the cookie has been cleared
    }
  });
  $('#loginbutton').click(function() {
     FB.login(function(response) {
     if (response.session) {
      // user successfully logged in
     } else {
      // user cancelled login
     }
  });
});
</script>
0

精彩评论

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