client: Fix authentication bugs.