roughike / flutter_facebook_login

A Flutter plugin for allowing users to authenticate with native Android & iOS Facebook login SDKs.
BSD 2-Clause "Simplified" License
404 stars 332 forks source link

Adding Braintree plugin makes Facebook login to stop working. #240

Open scourgy opened 4 years ago

scourgy commented 4 years ago

I am working on an app that has social login and I am using the flutter_facebook_login plugin. It works fine, until I add another plugin - flutter_braintree. If it's added, then the app does not return any result when calling facebookLogin.logIn['email']. This happens only on Android. I guess it's something related to the flow - going out of the app, doing something, then returning a result (both Braintree and Facebook has this flow). I guess Braintree overrides something that makes Facebook stop working. Any ideas what could be wrong? I've read that it might be the onActivityResult function, but I am not aware of Android development and I am not sure. Any help will be very appreciated, thanks!

nicolobozzato commented 4 years ago

I have the same problem. It seems that you are right. I tried to open the android version of my application, I changed the order of the plugin import in the GeneratedPluginRegistrant.java, I put the facebook login plugin before the braintree one and the login works. Only problem to do that in the flutter app. The GeneratedPluginRegistrant.java keep getting generated by the pubspec.yaml that order the plugin in alphabetical order.

nicolobozzato commented 4 years ago

@scourgy I think I found a quick solution: just go back to flutter_braintree: 0.5.3 Pay attention to remove the caret sign so it doesn't update to the version 0.5.3+1 that I think is the one that break the facebook login plugin

scourgy commented 4 years ago

@nicolobozzato I've also found something like a fix. In the braintree plugin onActivityResult there is a check in the beginning of the method that returns true. Just change it to return false and now everything works correctly for all of the three plugins - braintree, facebook, google.

nicolobozzato commented 4 years ago

@scourgy the check at the beginning is the portion of code added with the last version 0.5.3+1. https://github.com/Pikaju/FlutterBraintree/pull/13 I'm not sure it's meaningful to keep that version after deactivating the code they add

pikaju commented 4 years ago

You are right, returning false makes more sense in this case. I will go ahead and fix this.

pikaju commented 4 years ago

Should be fixed in flutter_braintree 0.5.3+2. Sorry for the inconvenience.

peternagy1332 commented 4 years ago

Hi! I've created the mentioned PR and I agree with you, returning false is indeed better. However, I think you are talking about two separate issues.

In the case @scourgy mentioned, an error arises during handling facebookLogin.logIn['email']. As you mentioned, returning false fixes this issue (I've also created a PR that fixes another braintree package).

On the other hand, what @nicolobozzato mentioned above (https://github.com/roughike/flutter_facebook_login/issues/240#issuecomment-587547836) there is a problem with the compilation and starting of the application at all. I get the following error, I hope someone could help:

Launching lib\main.dart on SM G950F in debug mode...
√ Built build\app\outputs\apk\debug\app-debug.apk.
D/FlutterActivity(13430): Using the launch theme as normal theme.
D/FlutterActivityAndFragmentDelegate(13430): Setting up FlutterEngine.
D/FlutterActivityAndFragmentDelegate(13430): No preferred FlutterEngine was provided. Creating a new FlutterEngine for this FlutterFragment.
W/FlutterEngine(13430): Tried to automatically register plugins with FlutterEngine (io.flutter.embedding.engine.FlutterEngine@7acb69c) but could not find and invoke the GeneratedPluginRegistrant.
D/FlutterActivityAndFragmentDelegate(13430): Attaching FlutterEngine to the Activity that owns this Fragment.
Error connecting to the service protocol: failed to connect to http://127.0.0.1:57557/cEbog9upPNo=/
Exited (sigterm)