Q:

How to logout with FBSDKLoginButton? (Weird error since Facebook assume I am logged in)

When I login through FBSDKLoginButton but the user has authenticated his account with another provider (such as Twitter or Google), I show him/her an error. The problem is that if the user clicks in the Facebook Login button again, the following is shown:

I call the FBSDKLogin tap from my custom button and the callback returns with the error, which makes all the more confusing.. If Facebook recognizes the error in authenticating, why does it show a logout dialog?
@IBAction func facebookLogin(_ sender: Any) {
    fbLoginButton.sendActions(for: .touchUpInside)
}

func loginButton(_ loginButton: FBSDKLoginButton!, didCompleteWith result: FBSDKLoginManagerLoginResult!, error: Error!) {
    if let error = error {
        // How can I perhaps solve the problem here calling __.logOut()?
        print(error.localizedDescription)
        return
    }

    if let curr = FBSDKAccessToken.current() {
        let credential = FacebookAuthProvider.credential(withAccessToken: curr.tokenString)
        firebaseLogin(credential: credential)
    }
}

A:

You will have been signed in via the FBSDKLoginManager as well.
Just logout using FBSDKLoginManager().logOut() when you sign out of Firebase.

