facebook login showing only previous logged in account in flutter app

692

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

Share:
692
Admin
Author by

Admin

Updated on December 26, 2022

Comments

  • Admin
    Admin over 1 year

    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