-
-
Notifications
You must be signed in to change notification settings - Fork 331
logInWithReadPermissions never ends #10
Comments
Hey! A quick observation: you're using Futures, but without the Here's how you would refactor your code to get it return the token in a successful login case: Future<String> loginWithFaceBook() async {
var result = await facebookLogin.logInWithReadPermissions(['email', 'public_profile'])
switch (result.status) {
case FacebookLoginStatus.loggedIn:
return result.accessToken.token;
case FacebookLoginStatus.cancelledByUser:
throw new StateError("Cancelled by user");
case FacebookLoginStatus.error:
throw new StateError(result.error.toString());
}
return null;
} See if that helps! Personally, I would still do something like outlined here: https://github.com/roughike/flutter_facebook_login/blob/master/lib/flutter_facebook_login.dart#L16-L31 |
Thanks for your reply. I've just tried this and got the same result. My code as it is now:
I thought there might be a problem with me not registering native Facebook activity on the android side, but after double checking everything I just can't find the problem. |
Is the problem apparent only with Android and not iOS? Also, could you post your pubspec dependencies here. I have a certain hunch about other plugins that may be intercepting things. |
I've just tested it on iOS and it seems to work fine. And regarding the pubspec dependencies:
I'll try to remove some plugins temporarily (starting with url_launcher) to check your whether any of them is intercepting facebook callback. |
I've got my dependencies down to
and the problem remains. I therefore assume that I've done something wrong while following the instructions for Android setup. However, I just can't seem to find the mistake. My android manifest:
|
Looking good so far. I'll assume your strings.xml is also fine? Did you also stop and fully restart your app after you removed all the extra dependencies? |
Yes strings.xml is fine and I did restart the app. I've now successfully integrated this plugin into a blank flutter app so I'm considering this our internal issue. Thank you for all the support and sorry to bother you. Have a good day! |
Please do comment once you find what was wrong, if possible! And if you can't figure out, I'm happy to help in private too. Have a good one :) |
I've found the issue. And it is so dumb I've surprised even myself. The whole story goes: We have implemented native calls to launch and process Braintree payments via their drop-in UI. And to do that, we had to override So there it is, the obvious bug that made me check everything countless times and bang my head against the wall. But things like this happen. Thank you for all the help and sorry to bother you. |
That's not stupid at all! I've actually banged my head into the wall numerous times because of the same reason. I was referring to this when I requested to see your pubspec file - I was going to check if you had any plugins that blocked this plugin from receiving results. So this was really valuable, because now I can quicker identify the same problem if I or someone else comes across with it. Thanks for following up! |
@zigapk Can you share your Braintree code, please? I am having the same issue, but I am unable to resolve it. Difference is that I am not using any native code for the Braintree, entirely rely on the Braintree and Facebook plugins. |
Hi there!
I'm writing an app and am struggling to make facebook login work. I've followed all the instructions but logInWithReadPermissions method just doesn't seem to ever return (even if I log in or cancel the Facebook dialog).
My code:
I know this is not an actual issue but I'd really appreciate some help.
Thank you in advance.
The text was updated successfully, but these errors were encountered: