My facebook app make Infinite loop in sdk 3.1.1

被刻印的时光 ゝ 提交于 2019-12-11 07:25:51

问题


I have iframe facebook app but reload making infinite loop.

Yesterday work fine, but not to day.

I'm using javascript and php sdk 3.1.1 with this code:

 <div id="fb-root"></div>
 <script src="http://connect.facebook.net/en_US/all.js"></script>
 <script>
  FB.init({
    oauth: true, // turn oauth 
    appId  : 'myappId',
    status : true, // check login status
    cookie : true, // enable cookies to allow the server to access the session
    xfbml  : true  // parse XFBML
  });
 FB.Canvas.setAutoGrow();
 </script>

 FB.getLoginStatus(function(response) {
      if (response.session) {
        var query = FB.Data.query('select publish_stream from permissions where uid={0}', response.authResponse.userID);
........................
      }
 }

If I delete "<script src="http://connect.facebook.net/en_US/all.js"></script>" line, it does not infinite loop, but the app not work like i want.


回答1:


Facebook migrated JavaScript SDK to support OAuth2, and requiere that all apps must migrate to OAuth 2.0 by October 1, 2011 (but last time was december 14 2011) therefore, I change:

    FB.getLoginStatus(function(response) {
      if (response.session) {
........................
      }

by

    FB.getLoginStatus(function(response) {
      if (response.authResponse) {
........................
      }

because the app was initialized with OAuth 2.0 enabled.

case closed.



来源:https://stackoverflow.com/questions/8509743/my-facebook-app-make-infinite-loop-in-sdk-3-1-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!