mgcrea / cordova-facebook-connect

Cordova ARC plugin for the Facebook SDK
94 stars 43 forks source link

ios 5.1 - redirected to the facebook hackbook app after login #10

Closed rbahumi closed 11 years ago

rbahumi commented 11 years ago

Hi,

I am using your plugin on ios 5.1 with cordova-1.9.0.js.

I have setup an automatic login attempt, which is bind to cordova's 'deviceready ' event.

When my app loads, I first see the index.html file, and immediately being redirected to my app login page.

The login succeeds, but it redirects me to Facebook's Hackbook application screen - which is really weird...

Do you have any idea what might cause that?

Regards, Roei.

rbahumi commented 11 years ago

Some additional details: Here is my index.html file:

<html>
<head>

<script type="text/javascript" src="js/cordova-1.9.0.js"></script>
<script type="text/javascript" src="js/plugins/FacebookConnect.js"></script>
<script src="js/jquery.min.1.7.1.js" type="text/javascript"></script>
<script src="js/jquery.mobile.1.2.test.js"></script>
<script>

  var APP_ID = '352872202215';
  document.addEventListener('deviceready', foo, false);

  function foo(){
    var facebookConnect = window.plugins.facebookConnect;

    facebookConnect.login({permissions: ["email", "user_about_me"], appId: APP_ID}, function(result) {
                          console.log("FacebookConnect.login:" + JSON.stringify(result));

                          // Check for cancellation/error
                          if(result.cancelled || result.error) {
                             console.log("FacebookConnect.login:failedWithError:" + result.message);
                             return;
                          } else console.log('succeeded!');
                          });
    }
</script>
</head>

<body>
    <button type="button" id="login" data-inline="false">login</button>
    <button type="button" id="post" data-inline="false">post</button>
</body>
</html>

And this is the output I see in the log, when my facebook app authorisation popup shows (this is before pressing 'Okay'):

2012-08-20 18:43:40.274 Surf-Space2[1798:c07] Multi-tasking -> Device: YES, App: YES
2012-08-20 18:43:43.533 Surf-Space2[1798:c07] -[FacebookConnect login:withDict:] [Line 85] login:(
    FacebookConnect1
)
 withDict:{
    appId = 352872202215;
    permissions =     (
        email,
        "user_about_me"
    );
}```

From this point on, I'm being redirected to the facebook's demonstration 'Hackbook' mobile application, 
and no additional info is added to the console log. 

Please advice.
rbahumi commented 11 years ago

Well, I've switched to cordova 2.0.0 and... I need to run a few more tests, but... it seems like it solve the problem.

I will update once I'm sure. Roei

mgcrea commented 11 years ago

I would have thought of an error in your facebook app configuration. But for sure 1.9 was a really buggy release so it's way better to go with the 2.0.