davejohnson/phonegap-plugin-facebook-connect — Issue #69: Login always required, FB.init() doesn't restore previous session properly on iOS
Author: webmat
Created: 2011-12-09 21:29:46+00:00
State: open

Hey guys,

I'm trying to use the plugin. The main flow of first time use works well. I'm able to log in, then make API calls (e.g. FB.api('/me') and so on).

However, when I reopen the app, the call to FB.init() doesn't seem to restore the session properly.

I've narrowed it down to the fact that the session I'm getting back from Facebook specifies the "expires" as a date string, rather than a unix timestamp (integer).

Therefore the session is never restored properly. See this part of the plugin's init():

```javascript
if (session && session.expires > new Date().valueOf()) {
FB.Auth.setSession(session, 'connected');
}
```

The following returns false, of course: `"2011-12-10 21:00:01 +0000" > new Date().valueOf()` :-)

My feeling is that this is caused by an incorrect settings on my Facebook app. I've tried to enable and disable "Upgrade to Requests 2.0", I've also made sure to keep old APIs available ("Remove Deprecated APIs" Disabled). I'm running out of ideas.

Did anyone encounter that problem? Can anyone offer suggestions to fix this?

Thanks in advance!

Mat

Note: I've made sure to use the older version of the FB SDK for iOS (commit 91f256424531030a454548693c3a6ca49ca3f35a), as suggested. I'm not removing the JSON code, as suggested in pull request #67.