Fix auth login and logout

And improve code coverage