Using facebook SDK on Android gives “User logged in as different Facebook user.” error

If you want to log in with the user that is now logged in on the Facebook app and you still have a token valid for a previous user, you can detect the error and log out in your FacebookCallback like this:

    @Override
    public void onError(FacebookException e) {
        if (e instanceof FacebookAuthorizationException) {
            if (AccessToken.getCurrentAccessToken() != null) {
                LoginManager.getInstance().logOut();
            }
        }
    }

Then you can log in again using the LoginManager.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)