Wizcorp / phonegap-facebook-plugin

The official plugin for Facebook in Apache Cordova/PhoneGap
Other
1.91k stars 2k forks source link

Login attempt results in state "FBSessionStateClosedLoginFailed", but error is nil #1253

Open andrewbusch7 opened 8 years ago

andrewbusch7 commented 8 years ago

I'm updating the plugins on an app I look after, and unfortunately the latest version plugin seems to be playing up. Running Cordova 6.1.1.

When I call:

facebookConnectPlugin.login(['public_profile'], successCallback, onFailure)

Safari (or actually the Facebook app as I've added the URL permissions) gets shown, I'm prompted to log in, all goes well and it throws me back to the app, but neither successCallback nor onFailure get called.

I've traced this issue into the obj-c plugin code, and it seems that the callback sessionStateChanged is running with FBSessionState being equal to "FBSessionStateClosedLoginFailed", but there's no error. I've tried it many times, both via Safari and the FB app, and with 'email' as the permission instead, and it's still giving me the same results. Except Safari doesn't actually run the callback, it does nothing. Also have ripped out all other plugins so it's definitely not some conflict.

No errors appearing in the JS or the Xcode console.

I've also setup the .plist correctly:

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>fb0123456789</string>
        </array>
    </dict>
</array>

<key>FacebookAppID</key>
<string>0123456789</string>

*actual FB ID replaced with 0123456789

At this point I'm pretty well stuck, can't see any new directions to figure this out aside from trawling through the old versions of Cordova and this plugin and investigating differences (as the live app is working but was built with older versions), and I'd reaaaallyy rather avoid doing that!

andrewbusch7 commented 8 years ago

Ok now it's failing when I'm on Cordova@5.4.1, and have this plugin @ commit tagged v0.12.0 and ttps://github.com/EddyVerbruggen/cordova-plugin-googleplus @ edge, and I'm getting the same issue again. But it works fine without the googleplus plugin.

I just tested Cordova@6.1.1 again, and with only this plugin in the project I still get this error. It's worth noting that this error appears before the FB app is switched too, rather than after.

andrewbusch7 commented 8 years ago

Ok finally have a working build using Cordova@5.4.1, FB@Edge and GPlus@4.0.5 (19 Nov 2015). GPlus plugin has done heaps since so the clash has been introduced since then.

Outstanding bad configs when using FB@Edge:

Can anyone else recreate these issues? Would be interesting if they were limited to me!