开发者

Facebook OAuth2.0 Implementation

I am new to Facebook implementation . Please help me to implement this code through new all.js using OAuth2.0

 window.addEvent('domready', function(){     
 FB.init("<%= ConfigurationManager.AppSettings["ApiKey"].ToString() %>", 
         "/xd_receiver.htm",
         {"ifUserConnected": update_user_is_connected,
          "ifU开发者_如何学CserNotConnected": update_user_is_not_connected,
          "doNotUseCachedConnectState":"true"});
});


The question doesn't really explain much, but guessing a little bit, something like this should do (I'm not familiar with the old api, so I don't know whether you have to pass any arguments to update_user_is_connected/not_connected, modify that accordingly):

window.fbAsyncInit = function() {
    FB.init({
        appId  : '<%= ConfigurationManager.AppSettings["ApiKey"].ToString() %>',
        status : true, // check login status
        cookie : true, // enable cookies to allow the server to access the session
        xfbml  : true,  // parse XFBML
        channelUrl  : 'http://www.yourdomain.com/channel.html', // Custom Channel URL
        oauth : true //enables OAuth 2.0
    });

    FB.getLoginStatus(function(response) {
        if (response.authResponse) update_user_is_connected();
        else update_user_is_not_connected();
    });

    // This will be triggered as soon as the user logs into Facebook (through your site)
    FB.Event.subscribe('auth.login', function(response) {
        update_user_is_connected();
    });
};

You can read more at:

http://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜