fixed logout (T-6092)

What about synchronous call?

Also there are several places where we call logout (for example see login() and loginWithFacebook). These error codes are not handled there.