我对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"});
});发布于 2011-07-29 23:10:21
这个问题并没有真正解释太多,但猜测一下,应该是这样的(我不熟悉旧的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/
https://stackoverflow.com/questions/6874718
复制相似问题