jeduan / cordova-plugin-facebook4

Use the latest Facebook SDK in your Cordova and Ionic projects
Other
764 stars 509 forks source link

Plugin does not work on browser platform with Cordova 9 #872

Closed ryaa closed 3 years ago

ryaa commented 4 years ago

There is an error in console

FB.login() called before FB.init()

Bug or feature request

[x] I'm reporting a reproducible issue with the code [ ] I'm reporting a feature request

Describe the Bug of feature request Install and configure this plugin with Cordova 9.

The problem is that after_prepare.js hook for browser platform tries to read APP_ID value from config.xml however as of the latest Cordova 9 plugins and their preferences are saved into package.json (see https://github.com/apache/cordova-docs/issues/1004#issuecomment-510598007) so APP_ID value is not found and is not set as required.

The fix could be, if APP_ID value is not found, try to read it from package.json and set if found.

Expected Behavior

FB login should work on browser platform when Cordova 9 is used.

Sample repo N/A

Plugin version, OS, devices, etc FB plugin version 6.4.0

ionic info

Ionic:

   Ionic CLI          : 5.2.8 (/Users/alexryltsov/.nvm/versions/node/v10.16.3/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.8
   @ionic/app-scripts : 3.2.4

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.1.0, browser 6.0.0, ios 5.1.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 17 other plugins)

Utility:

   cordova-res : not installed
   native-run  : 0.2.8 (update available: 1.0.0)

System:

   Android SDK Tools : 26.1.1 (/Users/alexryltsov/Library/Android/sdk/)
   ios-sim           : 8.0.2
   NodeJS            : v10.16.3 (/Users/alexryltsov/.nvm/versions/node/v10.16.3/bin/node)
   npm               : 6.9.0
   OS                : macOS Catalina
   Xcode             : Xcode 11.4 Build version 11E146

Additional Context N/A

Important note N/A

noahcooper commented 3 years ago

This plugin is deprecated. Check out cordova-plugin-facebook-connect. I've included the changes from your PR @ryaa:

https://www.npmjs.com/package/cordova-plugin-facebook-connect