I am using the plugin flutter_facebook_auth: ^3.3.2-no-nullsafety
on my Flutter app. Users can log in using Facebook to get Firebase Authentication:
LoginResult facebookLoginResult = await FacebookAuth.instance.login(
permissions: ['user_friends'],
loginBehavior: LoginBehavior.WEB_VIEW_ONLY);
if (faceBookLoginResult.status == LoginStatus.success) {
AccessToken _accessToken = facebookLoginResult.accessToken;
final userData = await FacebookAuth.instance.getUserData();
final FacebookAuthCredential facebookAuthCredential =
FacebookAuthProvider.getCredential(accessToken: _accessToken.token);
name = userData['name'];
await FirebaseAuth.instance
.signInWithCredential(facebookAuthCredential);
}
}
The code works as expected. But after a Facebook user is logged on to a device, I cannot sign in as a different user. For example, if I restart and go to the login dialog, and then enter login name and password for a different user, I get the dialog box: "You previously logged in to (this app) with Facebook. Would you like to continue?" The only options are "Continue", which signs in the previous user, or "cancel", which cancels the sign in.
I have tried a number of other ways to remove the Facebook user from the device :
- Clearing the app cache on the device
- Clearing the browser cache on the device
- Deleting the Facebook user in the "Authentication" panel of the Firebase Console
- Deleting the instance of the Facebook user altogether (it was a Facebook test user)
None of this worked.
I would really appreciate some help as it is impossible to debug the login flow if I can't sign in as a new user to test.