Search code examples
androidfirebase-authenticationfacebook-authentication

Logging in using Facebook displays logout prompt in Android using Firebase


I am developing an app for android. I am using Firebase as the backend and almost all of the app is complete except for a few niggles here and there. I am using Facebook sign in. After I have signed in I am signing out using a call to FirebaseAuth.signOut() . Along with this I am using intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK |Intent.FLAG_ACTIVITY_CLEAR_TOP); to create a new intent to go to my login screen. The problem crops up if I try to login using Facebook again. It pops up a dialog saying that I am already logged in and I need to log out along with a cancel and Logout button. I believe that the logout is being done on the Firebase end but not on the Facebook end. I dont know how to accomplish this. I will post any specific snippets required (since the app is too large at the moment).


Solution

  • Found it after some experimentation. Just have to make a call to LoginManager.getInstance().logOut() after FirebaseAuth.signOut().