Facebook登录错误Javascript
我在使用Facebook登录时没有遇到任何问题。。但奇怪的是,下一个错误开始出现在firebug控制台中,现在我无法登录 (新日期)。addMonths不是函数 provide(“”,{getLoginStatus:function…signed_请求,code'});返回a;}}}) 我正在使用Javascript SDKFacebook登录错误Javascript,facebook,facebook-javascript-sdk,Facebook,Facebook Javascript Sdk,我在使用Facebook登录时没有遇到任何问题。。但奇怪的是,下一个错误开始出现在firebug控制台中,现在我无法登录 (新日期)。addMonths不是函数 provide(“”,{getLoginStatus:function…signed_请求,code'});返回a;}}}) 我正在使用Javascript SDK <div id='fb-root'></div> <script> //<![CDATA[ window.
<div id='fb-root'></div>
<script>
//<![CDATA[
window.fbAsyncInit = function() {
FB.init({
appId : '205160466168923', // App ID
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
oauth : true, // enable OAuth 2.0
xfbml : true // parse XFBML
});
//channelUrl : '//www.clasesd.com/channel.html', // Channel File
// Additional initialization code here
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js#**oauth=1**&appId=205160466168923&xfbml=1";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
//]]>
</script>
已知问题,请参阅
正如关于这些问题的评论中所述,这是一个解决办法:
在调用FB.init()
FB.login(function(response) {
if (response.authResponse) {
FB.api('/me', function(response) {
console.log('Good to see you, ' + response.name + '.');
window.location = redirect_url;
});
} else {
console.log('User cancelled login or did not fully authorize.');
}
}, {scope: 'email, offline_access, publish_stream, user_events'});
});
Date.prototype.addMonths = function(n) {
this.setMonth(this.getMonth()+n);
return this;
}