Ошибка входа в Facebook Javascript - PullRequest
0 голосов
/ 04 января 2012

Я использовал вход в Facebook без проблем. Но, как ни странно, следующая ошибка начала появляться в консоли firebug, и теперь я не могу войти.

(новая дата) .addMonths не является функциейFB.provide ('', {getLoginStatus: function ... signature_request, code '}); вернуть a;}}});

Я использую Javascript SDK.

<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.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'});

});

1 Ответ

0 голосов
/ 04 января 2012

Известная проблема, см. http://developers.facebook.com/bugs/149848578458727

Как указано в комментариях к этим проблемам, это обходной путь:

Поместите следующий код перед вызовом FB.init()

Date.prototype.addMonths = function(n) {
    this.setMonth(this.getMonth()+n);
    return this;
}
...