NativeScript / nativescript-facebook

NativeScript plugin, wrapper of native Facebook SDK for Android and iOS
Apache License 2.0
79 stars 50 forks source link

Login for iOS doesn't work when Facebook App present and logged in #67

Closed ABarak64 closed 6 years ago

ABarak64 commented 7 years ago

Hi everyone,

I am unable to use this plugin to log into Facebook under the following conditions:

-iOS only (at least version 10, haven't tested others) -When the Facebook iOS app is installed on the device and the user is logged in within the Facebook area of the iOS general Settings page -When requesting additional publish permissions via the plugin (ex. Facebook.requestPublishPermissions(['manage_pages', 'publish_pages']))

In all other situations it appears to work, but under all these circumstances you first receive a tiny modal that asks if you wish to grant this app the additional permissions (looks very different than when official Facebook app not installed), and clicking OK will result in an error with the message "The Facebook account has not been configured on the device." I have confirmed that I am successfully logged into the Facebook app and it shows as such in the Settings page of iOS.

Looking around (https://stackoverflow.com/questions/31276710/fbsdkloginbehaviorsystemaccount-not-working) it seems like this might be an issue with the Facebook iOS SDK itself, and I can't tell if a newer version to what is being used in this plugin is available, or whether that would even help.

Any ideas on how to make it work in the circumstances described? Thank you.

-Edit: wanted to add that my Facebook app within the Facebook developer account is set to public and has all additionally requested permissions approved, so that shouldn't be an issue.

ABarak64 commented 7 years ago

My quick fix for this was to modify login-manager.ios.ts's FB_LOGIN_BEHAVIOUR to 1, which forces iOS devices to go through the native flow rather than attempting to grab the Facebook account info from the device settings. This now works in all situations.

In the future it would be cool to set what kind of iOS login behavior people want during init within the plugin.

DimitarTodorov commented 6 years ago

Hi @ABarak64 , This feature is implemented and published in the latest version of the plugin which is 2.1.0 and is available in npm. I'm closing the issue.