我是Facebook新手。请帮助我使用OAuth2.0
通过新的all.js实现此代码 window.addEvent('domready', function(){
FB.init("<%= ConfigurationManager.AppSettings["ApiKey"].ToString() %>",
"/xd_receiver.htm",
{"ifUserConnected": update_user_is_connected,
"ifUserNotConnected": update_user_is_not_connected,
"doNotUseCachedConnectState":"true"});
});
答案 0 :(得分:1)
这个问题并没有真正解释得多,但是猜一点,这样的事情应该做(我不熟悉旧的api,所以我不知道你是否必须将任何参数传递给update_user_is_connected / not_connected,相应地修改它:
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();
});
};
您可以在以下网址阅读更多内容:
http://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/