Fixed many bugs with auth. Now auth works!
When auth fails it tries to reconnect (maybe I should fix this behavior).
When auth is OK the UI does not get notified, which I don't know why.