Euler Geek
Euler Geek

Reputation: 131

My facebook app make Infinite loop in sdk 3.1.1

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.

Upvotes: 1

Views: 831

Answers (1)

Euler Geek
Euler Geek

Reputation: 131

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.

Upvotes: 1

Related Questions