Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to switch Facebook user #33

Closed
mchurichi opened this issue Nov 19, 2020 · 4 comments
Closed

Unable to switch Facebook user #33

mchurichi opened this issue Nov 19, 2020 · 4 comments

Comments

@mchurichi
Copy link

mchurichi commented Nov 19, 2020

Describe the bug
Hey, thanks for this plugin.
I'm facing an issue when trying to test the app with multiple Facebook users.
The first time I run the app it asks for my Facebook credentials and then signs me in, but when I try to trigger the login again it just prompts to log in with the same user just by clicking Continue, or Cancel the login, I don't have an option to sign in as a different user.
I even tried login me out but still the same.

Environment
Flutter 1.22.2 on an iOS Emulator running iOS 14.2.
flutter_facebook_auth: 1.0.1

To Reproduce

  _onSignInWithFacebook() async {
    try {
      AccessToken accessToken = await FacebookAuth.instance.isLogged;
      if (accessToken != null) {
        await FacebookAuth.instance.logOut();
      }
      accessToken = await FacebookAuth.instance.login();
      final userData = await FacebookAuth.instance.getUserData();
      print(userData);
    } catch (e, s) {
      if (e is FacebookAuthException) {
        print(e.message);
        switch (e.errorCode) {
          case FacebookAuthErrorCode.OPERATION_IN_PROGRESS:
            print("You have a previous login operation in progress");
            break;
          case FacebookAuthErrorCode.CANCELLED:
            print("login cancelled");
            break;
          case FacebookAuthErrorCode.FAILED:
            print("login failed");
            break;
        }
      }
    }
  }

Expected behavior
Every time it opens the facebook login it should let me log in as a previous user OR as a different user.

@darwin-morocho
Copy link
Owner

@mchurichi this plugin use the official Facebook sdk when you call to login you always see a confirmation page to allow the login. Could you send me that page?. I think the Facebook sdk must allow switch the account in this page.

@mchurichi
Copy link
Author

mchurichi commented Nov 19, 2020

Thanks for the quick response, this is the page I see when I trigger the log in process:
(sorry it's in spanish, but I think you know the language)

image

I only see the option to Continue or Cancel, no option to switch user, may I be doing something wrong?
Didn't post my pubspec or Info.plist because I think they are not related with the issue, but I can do it if needed.
Hitting continue gets me the right AccessToken, cancel raises a FacebookAuthErrorCode.CANCELLED FacebookAuthException.

@darwin-morocho
Copy link
Owner

@mchurichi after check the official Facebook sdk docs I found that the switch account is not available for Android and ios.
https://developers.facebook.com/docs/facebook-login/reauthentication/

facebook/facebook-ios-sdk#1147 (comment)

@mchurichi
Copy link
Author

oh man that's insane, you can't even properly log out, facebook always keeps you session somewhere... I know that's out of your plugin's scope, thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@mchurichi @darwin-morocho and others