facebook login showing only previous logged in account in flutter app

Viewed 849

I have successfully integrated the facebook login in the flutter application and able to login.

But it is always the same account I am able to login and it does not show me any other option to login other than the previous facebook account. Below is the code which I executed.

Future<void> handleLogin() async {
  final FacebookLoginResult result = await facebookLogin.logIn(['email']);
  switch (result.status) {
    case FacebookLoginStatus.cancelledByUser:
      break;
    case FacebookLoginStatus.error:
      break;
    case FacebookLoginStatus.loggedIn:
      try {
        await loginWithfacebook(result);
      } catch (e) {
        print(e);
      }
      break;
  }
}

Future loginWithfacebook(FacebookLoginResult result) async {
  final FacebookAccessToken accessToken = result.accessToken;
  AuthCredential credential =
  FacebookAuthProvider.credential(accessToken.token);
  var a = await _auth.signInWithCredential(credential);
  setState(() {
    isSignIn = true;
    _user = a.user;
  });
}

Future<void> gooleSignout() async {
  await _auth.signOut().then((onValue) {
    setState(() {
      facebookLogin.logOut();
      isSignIn = false;
    });
  });
}

Please suggest the modification of the code to remove the previous sign in through the facebook. Screenshot of the screen I see as always ScreenShot

2 Answers

Open your default Web browser and navigate to Facebook.com. Then logout from your Facebook account.

First, you must go to the settings of your FB app and remove the app from your FB account: https://www.businessinsider.com/how-to-delete-facebook-apps

Log out from the FB app on the phone and log in with a new acc. After that, you must open your browser on the phone and do logout from your FB account if it's logged in.

That will be enough to do sign in or sign up with a new FB account in your mobile app.

Related